/**
 * @note 页面初始化加载
 * @author 吴义迪
 * @create_time 2017-05-25
 */
$(function(){
	initBox();						//页面初始化
	initCss();						//页面初始化样式
	initMap();						//初始化地图
	//drawWarnType();
	/*requestWarnType();*/
	initTree();						//加载左侧树
	initVariable();					//初始化变量
	initStationByArea();			//初始化加载站点
	initSelectFeature(); 			//初始化SelectFeature图层控件（点图）
	initDrawFeature();				//初始化drawFeature控件
	eventListen();					//事件监听
	/*socketClient();				//监测报警websocket
	yjxhSocketClient();				//预警信号websocket
	*/
	 set();	 
});

function set(){
	//$("#indexIframe").attr("src", "zhfw.html?123");
	var ht = window.parent.document.URL;	
	if(ht.indexOf("?") >= 0 ){		
		var urltype = ht.split("?")[1].split("&")[0].substring(5);
		var urlparam = ht.split("?")[1].split("&")[1].substring(6);
		localStorage.setItem("type", urltype);
		localStorage.setItem("param", urlparam);
		loadAreaGeometry();
		if( urltype == "123" ){
			Global.common.chooseType == urlparam;
			Global.common.param1 = "everyDay," + urlparam;
			loadLayer(261);		
			$("#column").hide();
			showUser();	
		} else if( urltype == "nongqing" ){
			Global.common.chooseType == "nongqing";
			$("#column").hide();
			showAgri();	
			loadLayer(58);				
		} else if( urltype == "zaiqing" ){
			Global.common.chooseType == "zaiqings";
			$("#column").hide();
			showAgri();
			loadLayer(233);					
		} else if( urltype == "EXPERT" ){
			Global.common.chooseType == "EXPERT";
			Global.common.param1 = "everyDay," + urlparam;
			$("#column").hide();
			showeExpert();
			loadLayer(233);					
		}
	} else $("#column").show();
}

/**
 * @note 页面初始化大小
 * @author 吴义迪
 * @create_time 2017-05-25
 */
function initBox(){
	$(window.parent.document.body).css("overflow", "hidden");
	if($(".banner",window.parent.document).is(":visible")){
		$("#indexIframe",window.parent.document).css({"width":($(window.parent.window).width()+"px"),"height":(($(window.parent.window).height() - $(".banner",window.parent.document).outerHeight()) - $(".bar",window.parent.document).outerHeight() + "px")});
	}else{
		$("#indexIframe",window.parent.document).css({"width":($(window.parent.window).width()+"px"),"height":($(window.parent.window).height() + "px")});
	}
	$("#map").outerWidth($(window).width());
	$("#map").outerHeight($(window).height());
	if($("#collapseTwo").outerHeight() + 75 > $(window).height()){
		var menuHeight = $(window).height() - 125;
		$(".zhfw .nav,.zhfw .bottom").css("height", menuHeight + "px");
		$(".zhfw .con").css("height", menuHeight-70 + "px");
	}
	$(".zhfw-kuaijie").css("max-height", $("#collapseTwo").outerHeight() + "px");
	$(".time-check").css("left", ($(window).width() - $(".time-check").outerWidth())/2 + "px");
    //时间轴宽度
	$("#wu-time-line-shadow").css("width", ($(window).width() - 40 + "px"));
}

/**
 * @note 页面初始化样式
 * @author 吴义迪
 * @create_time 2017-03-17
 */
function initCss(){
	//设置矢量底图选中效果
	$("#map_layer_ter").css("border", "2px solid #337FE5");
	$("#map_layer_ter_p").css("color", "#337FE5");
	//综合服务滚动条加载
	new addScroll('scrollMainBox','scrollContent','scrollDiv');
	new addScroll('scrollMainBox1','scrollContent1','scrollDiv');
	if($("#usermessage", window.parent.document).attr("userType") == "superadmin" || $("#usermessage", window.parent.document).attr("userType") == "admin"){
		$("#yuZhiLegend-set").show();
	}
}

/**
 * @note 页面初始化地图
 * @author 吴义迪
 * @create_time 2017-05-25
 */
function initMap(){
	Global.common.map = new SuperMap.Map("map", {
		controls: [
			//滚动条控制图层缩放
			new SuperMap.Control.Navigation(),
			//键盘控制缩放平移
			new SuperMap.Control.KeyboardDefaults()
		],
		allOverlays: true,
		projection: "EPSG:4326",
		maxZoom: 14,
		minZoom: 4
	});
	
	//调用天地图接口直接加载
	Global.common.layer1 = new SuperMap.Layer.Tianditu({"layerType":"vec"});
	Global.common.layer2 = new SuperMap.Layer.Tianditu({"layerType":"img"});
	Global.common.layer3 = new SuperMap.Layer.Tianditu({"layerType":"ter"});
	Global.common.layer4 = new SuperMap.Layer.Tianditu({"layerType":"vec", "isLabel":true});
	Global.common.layer5 = new SuperMap.Layer.Tianditu({"layerType":"img", "isLabel":true});
	Global.common.layer6 = new SuperMap.Layer.Tianditu({"layerType":"ter", "isLabel":true});
	
	//加载边界图层及遮罩图层
	Global.common.borderLayer = new SuperMap.Layer.Vector("borderLayer");
	Global.common.maskLayer = new SuperMap.Layer.Vector("maskLayer");
	Global.common.map.addLayers([Global.common.layer1, 
	                             Global.common.layer2, 
	                             Global.common.layer3, 
	                             Global.common.maskLayer,
	                             Global.common.borderLayer, 
	                             Global.common.layer4, 
	                             Global.common.layer5, 
	                             Global.common.layer6
	                             ]);
	//设置底图显隐性
	Global.common.layer1.setVisibility(false);
	Global.common.layer2.setVisibility(false);
	Global.common.layer3.setVisibility(true);
	Global.common.layer4.setVisibility(false);
	Global.common.layer5.setVisibility(false);
	Global.common.layer6.setVisibility(true);
	Global.common.map.zoomToExtent(new SuperMap.Bounds(105.15, 28.05, 110.30, 32.35));
	//加载行政区划地理信息数据，生成边界图层、遮罩图层
	loadAreaGeometry();
}
/**
 * @note 选中市县确定后定位地图中心
 * @author 李峰
 * @create_time 2018-04-19
 */
function setCenter(lon,lat,areacode){
	//加载边界图层及遮罩图层
	Global.common.borderLayer.removeAllFeatures();
	Global.common.maskLayer.removeAllFeatures();
	loadAreaGeometry();
	//重新加载以显示图层
	$(".scrollContentDiv .check_box[layerid]").each(function(){
		var id = this.attributes.layerid.nodeValue;
		if($("#tree_li_"+id+"_img4").css("display") != "none" && $("#tree_li_"+id+"_img4").css("display") != null){
			//$("#tree_li_"+id+"_img3").show();
			//$("#tree_li_"+id+"_img4").hide();
			closeLayer(id);
			loadLayer(id);
		}
	});
	
}


/**
 * @note 加载底图
 * @author 吴义迪
 * @create_time 2017-07-18
 */
function addBaseLayer(){
	Global.common.map.addLayer(this);
	if(Global.common.map.getLayerIndex(Global.common.layer1) != -1 && 
	   Global.common.map.getLayerIndex(Global.common.layer2) != -1 && 
	   Global.common.map.getLayerIndex(Global.common.layer3) != -1 &&
	   Global.common.map.getLayerIndex(Global.common.layer4) != -1 &&
	   Global.common.map.getLayerIndex(Global.common.layer5) != -1 &&
	   Global.common.map.getLayerIndex(Global.common.layer6) != -1){
		setBaseLayerIndex();
	}
}

/**
 * @note 设置底图顺序
 * @author 吴义迪
 * @create_time 2017-07-18
 */
function setBaseLayerIndex(){
	Global.common.map.setLayerIndex(Global.common.layer1,0);
	Global.common.map.setLayerIndex(Global.common.layer2,1);
	Global.common.map.setLayerIndex(Global.common.layer3,2);
	Global.common.map.setLayerIndex(Global.common.borderLayer,4);
	Global.common.map.setLayerIndex(Global.common.maskLayer,3);
	Global.common.map.setLayerIndex(Global.common.layer4,5);
	Global.common.map.setLayerIndex(Global.common.layer5,6);
	Global.common.map.setLayerIndex(Global.common.layer6,7);
}

/**
 * @note 加载左侧树
 * @author 吴义迪
 * @create_time 2017-06-19
 */
function initTree(){
	requestAllLayersByFid("1", "scrollContent");	//请求父节点1下的所有子节点（图层）
}

/**
 * @note 初始化变量
 * @author 吴义迪
 * @create_time 2017-03-30
 */
function initVariable(){
	if(isIE = navigator.userAgent.indexOf("MSIE") != -1) { 
		Global.measure.labelYOffset1 = 0;
	}else if(isFirefox=navigator.userAgent.indexOf("Firefox") != -1){ 
		Global.measure.labelYOffset1 = 10;
	}else if(isChrome=navigator.userAgent.indexOf("Chrome") != -1){ 
		Global.measure.labelYOffset1 = 4;
	}
}

/**
 * @note 加载行政区划地理信息数据，生成边界图层、遮罩图层
 * @author 吴义迪
 * @create_time 2017-10-30
 */
function loadAreaGeometry(){
	var areacode = "50";//window.parent.storage["areacode"];localStorage.getItem("areaCode");
	console.log(areacode);
	if(areacode==undefined || areacode=="50"){
		areacode = "500000";
		$.ajax({
			url: "state.json",
			type: "post",
			data: {code: areacode},
			dataType: "json",
			//回调函数
			success:function(result){
				var pointValue = result.data;
				if(pointValue != null && pointValue.bound != null && pointValue.bound.length > 0){
					var polygonArray = [];
					var polygonArray1 = [];
					//外层边界
					var boundPonits = [
									   new SuperMap.Geometry.Point(-180, -90),
									   new SuperMap.Geometry.Point(180, -90),
									   new SuperMap.Geometry.Point(180, 90),
									   new SuperMap.Geometry.Point(-180, 90),
									   new SuperMap.Geometry.Point(-180, -90)
					];
					var boundLine = new SuperMap.Geometry.LinearRing(boundPonits);
					polygonArray1.push(boundLine);
					
					var border = pointValue.border;
					Global.common.bounds = pointValue.border;
					//居中
					// if(border != null && border.indexOf(",") > 0){
					// 	var b = border.split(",");
					// 	Global.common.map.zoomToExtent(new SuperMap.Bounds(105.15, 28.05, 110.30, 32.35));
					// }
					//区域边界，考虑飞地
					for(var a=0; a<pointValue.bound.length; a++){
						var points = [];
						var arr = pointValue.bound[a];
						for(var i=0; i<arr.length; i++){
							var p = new SuperMap.Geometry.Point(arr[i][0],arr[i][1]);
							points.push(p);
						}
						
						var line = new SuperMap.Geometry.LinearRing(points);
						polygonArray.push(line);
						polygonArray1.push(line);
					}							
					
					var region = new SuperMap.Geometry.Polygon(polygonArray);
					var regionVector = new SuperMap.Feature.Vector(region);
					regionVector.style = {
							strokeColor: '#ff0000',
							strokeWidth: 3,
							strokeOpacity: 0.5,
							fill: false
					};
					//Global.common.borderLayer.removeAllFeatures();
					Global.common.borderLayer.addFeatures([regionVector]);
					var region1 = new SuperMap.Geometry.Polygon(polygonArray1);
					var regionVector1 = new SuperMap.Feature.Vector(region1);
					regionVector1.style = {
							strokeWidth: 0,
							fillColor: "#AAC5EE",
							fillOpacity: 0.4,
							fill: true
					};
					Global.common.maskLayer.addFeatures([regionVector1]);
				}
			}
		});
	}else{
		$.ajax({
			url: Global.common.ajaxPath + "/coordinates/getLineByCode.do",
			type: "post",
			data: {code: areacode},
			dataType: "json",
			//回调函数
			success:function(result){
				if(result.status == 1){
					var pointValue = result.data;
					if(pointValue != null && pointValue.bound != null && pointValue.bound.length > 0){
						var polygonArray = [];
						var polygonArray1 = [];
						//外层边界
						var boundPonits = [
						                   new SuperMap.Geometry.Point(-180, -90),
						                   new SuperMap.Geometry.Point(180, -90),
						                   new SuperMap.Geometry.Point(180, 90),
						                   new SuperMap.Geometry.Point(-180, 90),
						                   new SuperMap.Geometry.Point(-180, -90)
						];
						var boundLine = new SuperMap.Geometry.LinearRing(boundPonits);
						polygonArray1.push(boundLine);
						
						var border = pointValue.border;
						Global.common.bounds = pointValue.border;
						//居中
						if(border != null && border.indexOf(",") > 0){
							var b = border.split(",");
							Global.common.map.zoomToExtent(new SuperMap.Bounds(parseFloat(b[0]),parseFloat(b[1]),parseFloat(b[2]),parseFloat(b[3])));
						}
						//区域边界，考虑飞地
						for(var a=0; a<pointValue.bound.length; a++){
							var points = [];
							var arr = pointValue.bound[a];
							for(var i=0; i<arr.length; i++){
								var p = new SuperMap.Geometry.Point(arr[i].split(",")[0],arr[i].split(",")[1]);
								points.push(p);
							}
							
							var line = new SuperMap.Geometry.LinearRing(points);
							polygonArray.push(line);
							polygonArray1.push(line);
						}							
						
						var region = new SuperMap.Geometry.Polygon(polygonArray);
						var regionVector = new SuperMap.Feature.Vector(region);
						regionVector.style = {
								strokeColor: '#ff0000',
								strokeWidth: 3,
								strokeOpacity: 0.5,
								fill: false
						};
						Global.common.borderLayer.removeAllFeatures();
						Global.common.borderLayer.addFeatures([regionVector]);
						
						var region1 = new SuperMap.Geometry.Polygon(polygonArray1);
						var regionVector1 = new SuperMap.Feature.Vector(region1);
						regionVector1.style = {
								strokeWidth: 0,
								fillColor: "#AAC5EE",
								fillOpacity: 0.4,
								fill: true
						};
						Global.common.maskLayer.addFeatures([regionVector1]);
					}
				}
			}
		});
	}
	
}

/**
 * @note 初始化SelectFeature图层控件
 * @author 吴义迪
 * @create_time 2016-11-24
 */
function initSelectFeature(){
	Global.common.selectFeature = new SuperMap.Control.SelectFeature(Global.common.selectFeatureLayers, {
        callbacks: {
        	//点击
            click: function(f){								
            	if(f.info){
            		//测距删除
            		if(f.info.layerId && f.info.layerId == Global.measure.lengthLayerX.id){
            			removeMeasureFeature(f);
            		}else if(f.info.layerId && Config.linkLayers.indexOf(","+f.info.layerId+",") >= 0){
            			window.top.open(f.info[Config[f.info.layerId].linkUrl]);
            		}else if(f.info.layerId && "yjxh" == f.info.layerId){
            			openYJXHPopup(f);
            		}else if(f.info.layerId && Config.layerTypeT.indexOf(","+f.info.layerId+",") >= 0 || Config.layerTypeZ.indexOf(","+f.info.layerId+",") >= 0){
            			openNPointLayerPopup(f);
            		}else if(f.info.layerId && Config.layerTypeFarm.indexOf(","+f.info.layerId+",") >= 0){
            			openNPointLayerPopup(f);
            		}else if(f.info.layerId && Config.station.indexOf(","+f.info.layerId+",") >= 0){
						openBasePointLayerPopup(f);
            		}else if(f.info.layerId == 261){
						setContent(f.info.userid);
					}
            	}
            },
            //鼠标移入
            over: function(f){
            	if(f.info){
            		if(f.info.layerId && "jcbj" == f.info.layerId){
            			openJCBJPopup(f);
            		}else if(f.info.layerId && Config.layerType2.indexOf(","+f.info.layerId+",") >= 0){
            			openLightningPopup(f);
            		}else if(f.info.layerId && "77" == f.info.layerId){
            			openScenicPopup(f);
            		}else if(f.info.layerId && "106" == f.info.layerId){
            			openPanoramaPopup(f);
            		}else if(f.info.layerId && Config.layerType3.indexOf(","+f.info.layerId+",") >= 0 && Config.station.indexOf(","+f.info.layerId+",") < 0){
            			openBasePointLayerPopup(f);
            		}else if(f.info.layerId && Config.layerType4.indexOf(","+f.info.layerId+",") >= 0){
            			openBasePointLayerPopup(f);
            		}else if(f.info.layerId && Config.layerType9.indexOf(","+f.info.layerId+",") >= 0){
            			openMicaps3Popup(f,f.info.returnColumnArr,f.info.layerId);
            		}else if(f.info.layerId && Config.layerType11.indexOf(","+f.info.layerId+",") >= 0){
            			openMicaps1Popup(f,f.info.returnColumnArr,f.info.layerId);
            		}else if(f.info.layerId && "110" == f.info.layerId){
            			openBasePointLayerPopup(f);
					}
            	}
            },
            //鼠标移出
            out: function(f){
				if(!f.isCluster){ //当目标聚散点的时候不执行动作
                	if( Config.layerTypeT.indexOf(","+f.info.layerId+",") >= 0 || Config.layerTypeZ.indexOf(","+f.info.layerId+",") >= 0 || Config.layerTypeFarm.indexOf(","+f.info.layerId+",") >= 0 || Config.station.indexOf(","+f.info.layerId+",") >= 0){
					} else if(f.info && f.info.layerId && ("yjxh" != f.info.layerId)){
						closePopup();
					}
            	}				
            }
        }
    });
	//将控件添加到地图上
	Global.common.map.addControl(Global.common.selectFeature);
    //激活控件。
	Global.common.selectFeature.activate();
}

/**
 * @note 初始化drawFeature控件
 * @author 吴义迪
 * @create_time 2017-07-16
 */
function initDrawFeature(){
	//几何
	Global.areaQuery.drawFeature = new SuperMap.Control.DrawFeature(Global.areaQuery.layer, SuperMap.Handler.Polygon);
	//圆
	Global.areaQuery.drawFeature1 = new SuperMap.Control.DrawFeature(Global.areaQuery.layer, SuperMap.Handler.RegularPolygon,{handlerOptions:{sides:50}});
    //矩形
	Global.areaQuery.drawFeature2 = new SuperMap.Control.DrawFeature(Global.areaQuery.layer, SuperMap.Handler.Box);
	//任意几何
	Global.areaQuery.drawFeature3 = new SuperMap.Control.DrawFeature(Global.areaQuery.layer, SuperMap.Handler.PolygonFree);
	Global.common.map.addControl(Global.areaQuery.drawFeature);
	Global.common.map.addControl(Global.areaQuery.drawFeature1);
	Global.common.map.addControl(Global.areaQuery.drawFeature2);
	Global.common.map.addControl(Global.areaQuery.drawFeature3);
	Global.areaQuery.drawFeature1.events.on({"featureadded": areaQueryDrawCompleted1});
	Global.areaQuery.drawFeature2.events.on({"featureadded": areaQueryDrawCompleted2});
	Global.areaQuery.drawFeature.events.on({"featureadded": areaQueryDrawCompleted});
	Global.areaQuery.drawFeature3.events.on({"featureadded": areaQueryDrawCompleted3});
}


/**
 * @note 监听事件
 * @author 吴义迪
 * @create_time 2017-05-25
 */
function eventListen(){
	$(window.parent.window).on("resize", windowResizeFunc);
	$("#tool").on("click", toolClickFunc);
	$("#tool_hide").on("mouseenter", {type:"enter", flag:"toolHide"}, toolMouseFunc);
	$("#tool_hide").on("mouseleave", {type:"leave", flag:"toolHide"}, toolMouseFunc);
	$("#header_menus_title").on("mouseenter", {type:"enter", flag:"title"}, toolMouseFunc);
	$("#header_menus_title").on("mouseleave", {type:"leave", flag:"title"}, toolMouseFunc);
	$("#header_menus_fullScreen").on("mouseenter", {type:"enter", flag:"fullScreen"}, toolMouseFunc);
	$("#header_menus_fullScreen").on("mouseleave", {type:"leave", flag:"fullScreen"}, toolMouseFunc);
	$("#header_menus_fullImage").on("mouseenter", {type:"enter", flag:"fullImage"}, toolMouseFunc);
	$("#header_menus_fullImage").on("mouseleave", {type:"leave", flag:"fullImage"}, toolMouseFunc);
	$("#header_menus_layer").on("mouseenter", {type:"enter", flag:"layer"}, toolMouseFunc);
	$("#header_menus_layer").on("mouseleave", {type:"leave", flag:"layer"}, toolMouseFunc);
	$("#header_menus_mask").on("mouseenter", {type:"enter", flag:"mask"}, toolMouseFunc);
	$("#header_menus_mask").on("mouseleave", {type:"leave", flag:"mask"}, toolMouseFunc);
	$("#header_menus_surface").on("mouseenter", {type:"enter", flag:"surface"}, toolMouseFunc);
	$("#header_menus_surface").on("mouseleave", {type:"leave", flag:"surface"}, toolMouseFunc);
	$("#header_menus_rang").on("mouseenter", {type:"enter", flag:"rang"}, toolMouseFunc);
	$("#header_menus_rang").on("mouseleave", {type:"leave", flag:"rang"}, toolMouseFunc);
	$("#header_menus_query").on("mouseenter", {type:"enter", flag:"query"}, toolMouseFunc);
	$("#draw_tool").on("mouseleave", {type:"leave"}, drawToolMouseFunc);
	$("#draw_tool").on("click", drawToolClickFunc);
	$("#map_layer").on("click", baseLayerChange);
	$("#SLTimeConfirm").on("click", SLTimeConfirmFunc);
	$("#SLTimeExit").on("click", SLTimeExitFunc);
	$("body").on("mousemove", dragMousemoveFunc);
	$("body").on("mouseup", dragMouseupFunc);
	$(".unSelect").on("click", closeAllLayers);
	$("#bxfb_div").on("click", bxfbClickFunc);
	$("#wu-time-content").on("click", timeAxisClickFunc);
	$("#radarTimeAxisPlay").on("click", timeAxisPlayFunc);
	$("#radarTimeAxisStop").on("click", timeAxisStopFunc);
	$("#timeAxisLeft").on("click", timeAxisLeftFunc);
	$("#timeAxisRight").on("click", timeAxisRightFunc);
	//时间轴触发
	laydate.render({
		elem: '#timeAxis_input_year',
		trigger: 'click',
		type: 'year',
		theme: '#4187e7',
		format: "yyyy-MM-dd HH:mm:ss",
		done: timeAxisCallback
	});
	laydate.render({
		elem: '#timeAxis_input_month',
		trigger: 'click',
		type: 'month',
		theme: '#4187e7',
		format: "yyyy-MM-dd HH:mm:ss",
		done: timeAxisCallback
	});
	laydate.render({
		elem: '#timeAxis_input_tendays',
		trigger: 'click',
		type: 'tendays',
		theme: '#4187e7',
		format: "yyyy-MM-dd HH:mm:ss",
		done: timeAxisCallback
	});
	laydate.render({
		elem: '#timeAxis_input_date',
		trigger: 'click',
		type: 'date',
		theme: '#4187e7',
		format: "yyyy-MM-dd HH:mm:ss",
		done: timeAxisCallback
	});
	laydate.render({
		elem: '#timeAxis_input_yubao',
		trigger: 'click',
		type: 'date',
		theme: '#4187e7',
		format: "yyyy-MM-dd HH:mm:ss",
		done: timeAxisCallback
	});
	laydate.render({
		elem: '#timeAxis_input_datetime',
		trigger: 'click',
		type: 'datetime',
		theme: '#4187e7',
		format: "yyyy-MM-dd HH:mm:ss",
		done: timeAxisCallback
	});
	laydate.render({
		elem: '#beginTime_input',
		trigger: 'click',
		type: 'datetime',
		theme: '#4187e7',
		format: "yyyy-MM-dd HH:mm:ss"
	});
	laydate.render({
		elem: '#endTime_input',
		trigger: 'click',
		type: 'datetime',
		theme: '#4187e7',
		format: "yyyy-MM-dd HH:mm:ss"
	});
	$('.time-line-show').on('click', showSideBar);
	$('.time-line-hid').on('click', hideSideBar);
	$('.legend-show').on('click', showSideLegend);
	$('.legend-hid').on('click', hideSideLegend);
	$("#zhfw-qjfs1").on('click', function(e){
		if($(e.currentTarget).attr("flag") == "0"){
			//清除其他专题图层
			var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
			if(arr.length > 0){
				closeZtLayers(arr[0].id);
			}
			$(e.currentTarget).siblings().attr("flag", "0");
			$(e.currentTarget).attr("flag", "1");
		}else{
			$(e.currentTarget).attr("flag", "0");
		}
		qjfs1Func();
	});
	$("#zhfw-qjfs2").on('click', function(e){
		if($(e.currentTarget).attr("flag") == "0"){
			//清除其他专题图层
			var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
			if(arr.length > 0){
				closeZtLayers(arr[0].id);
			}
			$(e.currentTarget).siblings().attr("flag", "0");
			$(e.currentTarget).attr("flag", "1");
		}else{
			$(e.currentTarget).attr("flag", "0");
		}
		qjfs2Func();
	});
	$("#zhfw-qjfs3").on('click', function(e){
		if($(e.currentTarget).attr("flag") == "0"){
			//清除其他专题图层
			var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
			if(arr.length > 0){
				closeZtLayers(arr[0].id);
			}
			$(e.currentTarget).siblings().attr("flag", "0");
			$(e.currentTarget).attr("flag", "1");
		}else{
			$(e.currentTarget).attr("flag", "0");
		}
		qjfs3Func();
	});
	$("#zhfw-qjfs4").on('click', function(e){
		if($(e.currentTarget).attr("flag") == "0"){
			//清除其他专题图层
			var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
			if(arr.length > 0){
				closeZtLayers(arr[0].id);
			}
			$(e.currentTarget).siblings().attr("flag", "0");
			$(e.currentTarget).attr("flag", "1");
		}else{
			$(e.currentTarget).attr("flag", "0");
		}
		qjfs4Func();
	});
	$("#zhfw-qjfs5").on('click', function(e){
		if($(e.currentTarget).attr("flag") == "0"){
			//清除其他专题图层
			var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
			if(arr.length > 0){
				closeZtLayers(arr[0].id);
			}
			$(e.currentTarget).siblings().attr("flag", "0");
			$(e.currentTarget).attr("flag", "1");
		}else{
			$(e.currentTarget).attr("flag", "0");
		}
		qjfs5Func();
	});
	$("#zhfw-qjfs6").on('click', function(e){
		if($(e.currentTarget).attr("flag") == "0"){
			//清除其他专题图层
			var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
			if(arr.length > 0){
				closeZtLayers(arr[0].id);
			}
			$(e.currentTarget).siblings().attr("flag", "0");
			$(e.currentTarget).attr("flag", "1");
		}else{
			$(e.currentTarget).attr("flag", "0");
		}
		qjfs6Func();
	});
	$("#zhfw-qjfs7").on('click', function(e){
		if($(e.currentTarget).attr("flag") == "0"){
			//清除其他专题图层
			var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
			if(arr.length > 0){
				closeZtLayers(arr[0].id);
			}
			$(e.currentTarget).siblings().attr("flag", "0");
			$(e.currentTarget).attr("flag", "1");
		}else{
			$(e.currentTarget).attr("flag", "0");
		}
		qjfs7Func();
	});
	$("#zhfw-qjfs8").on('click', function(e){
		if($(e.currentTarget).attr("flag") == "0"){
			//清除其他专题图层
			var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
			if(arr.length > 0){
				closeZtLayers(arr[0].id);
			}
			$(e.currentTarget).siblings().attr("flag", "0");
			$(e.currentTarget).attr("flag", "1");
		}else{
			$(e.currentTarget).attr("flag", "0");
		}
		qjfs8Func();
	});
	$(".panel-heading-imgs").hover(function () {
        $(this).toggleClass("act-img");
    });
	$("#zhfw-zt-legend-span").click(function(){
		if($("#zhfw-zt-legend-span").attr("flag") == "0"){
			$("#zhfw-zt-legend-span").attr("flag", "1");
			$("#zhfw-zt-legend-span").css("color", "rgba(65, 135, 231, 1)");
			//$("#zhfw-zt-legend-span1").show();
			//$("#zhfw-zt-legend").show();
		}else{
			$("#zhfw-zt-legend-span").attr("flag", "0");
			$("#zhfw-zt-legend-span").css("color", "");
			$("#zhfw-zt-legend-span1").hide();
			$("#zhfw-zt-legend").hide();
		}
	});
	$("#collapseTwo").on("show.bs.collapse", function(e){
		if(e.target.id == "collapseTwo"){
			$("#zhfw_zttc").attr("flag", "0");
			$("#zhfw_zttc").css("color", "#bbb");
			if($("#zhfw_tzlb").attr("flag") == "1"){
				$("#zhfw_tzlb").attr("flag", "0");
				$("#zhfw_tzlb").css("color", "#bbb");
			}else{
				$("#zhfw_tzlb").attr("flag", "1");
				$("#zhfw_tzlb").css("color", "#4187e7");
			}
		}
	});
	$("#collapseTwo").on("hide.bs.collapse", function (e){
		if(e.target.id == "collapseTwo"){
			$("#zhfw_zttc").css("color", "#bbb");
			if($("#zhfw_tzlb").attr("flag") == "1"){
				$("#zhfw_tzlb").attr("flag", "0");
				$("#zhfw_tzlb").css("color", "#bbb");
			}else{
				$("#zhfw_tzlb").attr("flag", "1");
				$("#zhfw_tzlb").css("color", "#4187e7");
			}
		}
	});
	$("#zhfw_tzlb").click(function(){
		$(".zhfw-kuaijie").hide();
	});
	$("#zhfw_zttc").click(function(){
		$("#zhfw_tzlb").attr("flag", "0");
		$("#zhfw_tzlb").css("color", "#bbb");
		$("#collapseTwo").removeClass("in");
		$(".zhfw-kuaijie").slideToggle(300);
		if($("#zhfw_zttc").attr("flag") == "1"){
			$("#zhfw_zttc").attr("flag", "0");
			$("#zhfw_zttc").css("color", "#bbb");
		}else{
			$("#zhfw_zttc").attr("flag", "1");
			$("#zhfw_zttc").css("color", "#4187e7");
		}
	});
	$('#zhfw_tzlb').click();
	//靶向发布
	$(".blur").click(function(){
        $(this).toggleClass("blur1");
    });
    $(".gl").click(function(){
    	$(".gl").removeClass("glyphicon glyphicon-ok");
        $(this).addClass("glyphicon glyphicon-ok");
    });
    
    $(".setYuZhi_div").click(function(e){
    	e = e || window.event;
    	if(e.target.id == "setYuZhi_confirm"){
    		updateYuZhi();
    	}else if(e.target.id == "setYuZhi_cancel"){
    		requestWarnType();
    	}else if(e.target.id == "setYuZhi_div_exit"){
    		$(".setYuZhi_div").hide();
    		requestWarnType();
    	}
    });
}

/**
 * @note 树点击监听事件
 * @author 吴义迪
 * @create_time 2017-06-30
 */
function treeClickFunc(e){
	e = e || window.event;
	//打开图层
	if(e.target.parentNode.attributes.layerid && e.target.id == "tree_li_"+e.target.parentNode.attributes.layerid.nodeValue+"_img3"){
		var id = e.target.parentNode.attributes.layerid.nodeValue;
		$("#tree_li_"+id+"_img3").hide();
		$("#tree_li_"+id+"_img4").show();
		//单选图层处理
		for(var i=0; i<Config.checkBoxLayer.length; i++){
			if(Config.checkBoxLayer[i].indexOf(","+id+",") > -1){
				var layerArr = Config.checkBoxLayer[i].split(",");
				for(var j=0; j<layerArr.length; j++){
					if(layerArr[j] != "" && layerArr[j] != id && $("#tree_li_"+id+"_img4").css("display") != "none" && $("#tree_li_"+id+"_img4").css("display") != null){
						$("#tree_li_"+layerArr[j]+"_img3").show();
						$("#tree_li_"+layerArr[j]+"_img4").hide();
						closeLayer(layerArr[j]);
					}
				}
			}
		}
		//加载图层
		loadLayer(id);
	}
	//关闭图层
	else if(e.target.parentNode.attributes.layerid && e.target.id == "tree_li_"+e.target.parentNode.attributes.layerid.nodeValue+"_img4"){
		var id = e.target.parentNode.attributes.layerid.nodeValue;
		$("#tree_li_"+id+"_img3").show();
		$("#tree_li_"+id+"_img4").hide();
		//关闭图层
		closeLayer(id);
	}
	//高级查询
	else if(e.target.parentNode.attributes.layerid && e.target.id == "tree_li_"+e.target.parentNode.attributes.layerid.nodeValue+"_img5"){
		var id = e.target.parentNode.attributes.layerid.nodeValue;
		if($("#tree_li_"+id+"_img4").is(":visible")){
			if($("#tree_li_"+id+"_advancedQueryDiv").is(":visible") == false){
				//加载高级面板
				if(Config.advancedQueryType1.indexOf(","+id+",") >= 0){
					loadAdvancedQueryDiv1(id);
				}else if(Config.advancedQueryType2.indexOf(","+id+",") >= 0){
					loadAdvancedQueryDiv2(id);
				}else{
					$(".menu1_div").hide();
					setAdvancedQueryDivTop($("#tree_li_"+id+"_img5"), $("#tree_li_"+id+"_advancedQueryDiv"));
					$("#tree_li_"+id+"_advancedQueryDiv").show();
				}
			}else{
				$("#tree_li_"+id+"_advancedQueryDiv").hide();
			}
		}
	}
}

/**
 * @note 加载图层
 * @param id：图层id
 * @author 吴义迪
 * @create_time 2017-06-30
 */
function loadLayer(id){
	var layerType = $("#tree_li_"+id+"").attr("layertype");
	var showType = $("#tree_li_"+id+"").attr("showType");
	//改变高级选项状态
	$("#tree_li_"+id+"_img5").attr("src", "resources/images/gaoji_checked.png");
	//加载高级面板
	if(Config.advancedQueryType3.indexOf(","+id+",") >= 0){
		if($("#tree_li_"+id+"_advancedQueryDiv").length <= 0){
			loadAdvancedQueryDiv3(id);
		}
	}else if(Config.advancedQueryType4.indexOf(","+id+",") >= 0){
		if($("#tree_li_"+id+"_advancedQueryDiv").length <= 0){
			loadAdvancedQueryDiv4(id);
		}
	}else if(Config.advancedQueryType6.indexOf(","+id+",") >= 0){
		if($("#tree_li_"+id+"_advancedQueryDiv").length <= 0){
			loadAdvancedQueryDiv6(id);
		}
	}else if(Config.advancedQueryTypeN.indexOf(","+id+",") >= 0){
		if($("#tree_li_"+id+"_advancedQueryDiv").length <= 0){
			loadAdvancedQueryDivN(id);
		}
	} else if(Config.advancedQueryType1.indexOf(","+id+",") >= 0){
		if($("#tree_li_"+id+"_advancedQueryDiv").length <= 0){
			loadAdvancedQueryDiv1(id);
		}
	}
	//时间轴控制
	if($("#tree_li_"+id+"").attr("timeaxis") == "1"){
		addTimeAxis(id);
	}
	//添加图例进图例数组
	if(Config.legendLayers.indexOf(","+id+",") >= 0){
		addLegend(id);
	}
	if(Config.noLegend.indexOf(","+id+",") < 0){
		requestLegend(id);	//请求图例
	}
	//iserver发布图层
	if(layerType == 1){
		//rest服务
		if(showType == "rest" || showType == "restLine"){
			loadRestLayer(id, showType);
		}
	}
	//雷电
	else if(Config.layerType2.indexOf(","+id+",") >= 0){
		if($("#beginTime_input").val() == "" || $("#endTime_input").val() == ""){
			//初始化时间
			var beginDate = new Date();
			beginDate.setMinutes(beginDate.getMinutes()-30);
			$("#beginTime_input").val(timeFormat1(beginDate));
			$("#endTime_input").val(timeFormat1(new Date()));
		}
		if($("#wu-time-line-shadow").is(":visible")){
			$(".time-check").css("bottom", "50px");
		}
		$(".time-check").show();
		loadingFunc(id, true);
		requestCimissLightning(id);
	}
	//气候区划
	else if(Config.layerTypeJ.indexOf(","+id+",") >= 0){
		var name, type;
		if(id==250){ //年平均风速
			name="wind";
			type="ziliao";
		}else if(id==251){ //年伏旱评率
			name="fdrou";
			type="zaihai";
		}else if(id==252){ //年暴雨日数
			name="baoyu";
			type="zaihai";
		}else if(id==253){//年<35℃日数
			name="over35";
			type="zaihai";
		}else if(id==254){//年平均温度
			type="ziliao"; 
			name="temp";
		}else if(id==255){//年日照
			type="ziliao"; 
			name="rizhao";
		}else if(id==256){//年平均相对湿度
			type="ziliao"; 
			name="humidity";
		}
		localStorage.setItem("name", name);
		localStorage.setItem("type", type);
		requestDataByParam(id);
	}
	//基本点图
	else if(Config.layerType3.indexOf(","+id+",") >= 0){
		requestBasePointLayer(id);
	}
	//涉农主体
	else if( id == 261 ){
		requestAgriPointLayer(id);
	}
	//铁路
	else if(Config.layerType4.indexOf(","+id+",") >= 0){
		requestRailwayInfo(id);
	}
	//聚散图
	else if(Config.layerType5.indexOf(","+id+",") >= 0){
		requestClusterLayer(id);
	}
	//云图
	else if(Config.layerType6.indexOf(","+id+",") >= 0){
		if(Config[id].initTimeAxisFlag == true){
			var param = getTimeAxisParam(id, "nephogram");
			initTimeAxis(id, param.value, param.index, param.index1, true);
			loadImages(id);
		}
		Config[id].initTimeAxisFlag = false;
		requestNephogramLayer(id);
	}
	//雷达
	else if(Config.layerType7.indexOf(","+id+",") >= 0){
		if(Config[id].initTimeAxisFlag == true){
			var param = getTimeAxisParam(id, "radar");
			initTimeAxis(id, param.value, param.index, param.index1, true);
			loadImages(id);
		}
		Config[id].initTimeAxisFlag = false;
		requestRadarLayer(id);
	}
	// //农事收集
	// else if(Config.layerTypeN.indexOf(","+id+",") >= 0){
	// 	requestNPointLayer(id);
	// }
	//自动站实况
	else if(Config.layerType9.indexOf(","+id+",") >= 0){
		if(Config[id].initTimeAxisFlag == true){
			var param = getTimeAxisParam(id, Global.common.param1.split(",")[0].toUpperCase());
			initTimeAxis(id, param.value, param.index, param.index1, false);
		}
		Config[id].initTimeAxisFlag = false;
		requestDataByParam(id);
	}
	//预警预报
	else if(Config.layerTypeYubao.indexOf(","+id+",") >= 0){
	    if(Config[id].initTimeAxisFlag == true){
		 	var param = getTimeAxisParam(id, "YUBAO");
		 	initTimeAxis(id, param.value, param.index, param.index1, false);
		}
		Config[id].initTimeAxisFlag = false;
		requestDataByParam(id);
	}
	//格点数据
	else if(Config.layerType10.indexOf(","+id+",") >= 0){
		if(Config[id].initTimeAxisFlag == true){
			var param = getTimeAxisParam(id, "grib");
			initTimeAxis(id, param.value, param.index, param.index1, false);
		}
		Config[id].initTimeAxisFlag = false;
		var startime = timeFormat2(new Date()).substring(0, 8);
		var gribType = $("#advancedQuery_type_"+id+">span[flag='1']").attr("param");
		if(GribData[gribType] != null){
			showGribLayer(id, GribData[gribType], gribType);
		}else{
			loadGribData(id, gribType, "3", "72", startime, "08");
		}
	}
	//地面填图
	else if(Config.layerType11.indexOf(","+id+",") >= 0){
		if(Config[id].initTimeAxisFlag == true){
			var param = getTimeAxisParam(id, "HOUR");
			initTimeAxis(id, param.value, param.index, param.index1, false);
		}
		Config[id].initTimeAxisFlag = false;
		requestSuperpositionDataByParam(id);
	}
	
	//电力保障专题
	if(id == "110"){
		requestBasePointLayer1(id, Global.common.ajaxPath + "/zhfw/getTowerInfo.do", "3");
	}
	
	//添加标题进标题数组
	addTitle(id);
	mapTitleFunc();
}

/**
 * @note 关闭图层
 * @param id：图层id
 * @author 吴义迪
 * @create_time 2017-06-30
 */
function closeLayer(id){
	//改变高级选项状态
	$("#tree_li_"+id+"_img5").attr("src", "resources/images/gaoji.png");
	//清除高级查询面板
	$("#tree_li_"+id+"_advancedQueryDiv").remove();
	//清除标题
	Global.common.kjTitle = [];
	//关闭气泡
	closePopup();
	//关闭曲线图窗口
	closeWindow();
	//关闭大图展示窗口
	CloseImageWin();
	//关闭窗口
	closeCompany();
	//图例删除
	if(Config.loadLegend.indexOf(","+id+",") < 0 && $("#tree_ul_"+id+" li").length > 0){
		$("#tree_ul_"+id).hide();
	}else{
		$("#tree_ul_"+id).empty();
	}
	//通用图层关闭
	var layers = Global.common.map.getLayersByName("layer_"+id+"");
	if(layers.length > 0){
		for(var i=0; i<layers.length; i++){
			if(layers[i].features){
				removeSelectFeatureLayersByName("layer_"+id+"");
				layers[i].removeAllFeatures();
			}
			Global.common.map.removeLayer(layers[i]);
		}
	}
	//预警信号
	if(Config.layerType8.indexOf(","+id+",") >= 0){
		var layers = Global.common.map.getLayersByName(Config.layerType8Name[0]);
		if(layers.length > 0){
			for(var i=0; i<layers.length; i++){
				if(layers[i].features){
					removeSelectFeatureLayersByName(Config.layerType8Name[0]);
					layers[i].removeAllFeatures();
				}
				Global.common.map.removeLayer(layers[i]);
			}
		}
		$("#zhfw-yjxh-div").hide();
		Global.common.yjxhValue = null;
	}
	// //涉农主体
	// else if ( id == 261){
	// 	Global.common.map.removeLayer( Global.common.map.getLayersByName("layer_"+ id)[0] );
	// 	removeSelectFeatureLayersByName("layer_"+ id);
	// }
	//灾情/农情
	else if(Config.layerTypeN.indexOf(","+id+",") >= 0){
		var mycars=[];
		if( id == "58" ){
			mycars = Config.layerTypeT;
			mycars += Config.layerTypeFarm;
		} else if( id == "233" ){
			mycars = Config.layerTypeT;
			mycars += Config.layerTypeZ;
		} else if( id == "104" ){
			mycars += Config.layerTypeFarm;
		}				
		mycars += Config.layerTypeN;		
		mycars = mycars.split(",");
		for ( j = 0; j < mycars.length; j++ ) {
			if ( Global.common.map.getLayersByName("layer_"+ mycars[j])[0] ) {
				Global.common.map.removeLayer( Global.common.map.getLayersByName("layer_"+ mycars[j])[0] );
				removeSelectFeatureLayersByName("layer_"+ mycars[j]);
				removePoiLegend(mycars[j]);							
				break;
			}
		}
	}
	//雷电
	else if(Config.layerType2.indexOf(","+id+",") >= 0){
		$(".time-check").hide();
		$("#beginTime_input").val("");
		$("#endTime_input").val("");
	}
	//聚散图
	else if(Config.layerType5.indexOf(","+id+",") >= 0){
		if(Config[id].selectCluster){
			Config[id].selectCluster.deactivate();
		}
		Global.common.map.removeControl(Config[id].selectCluster);
		Config[id].selectCluster = null;
	}
	//涉农主体
	else if( id == "261"){ 
		var radarLayers = Global.common.map.getLayersByName("layer_" + id);
		if(radarLayers.length > 0){
			for(var i=0; i<radarLayers.length; i++){
				if(radarLayers[i].features){
					removeSelectFeatureLayersByName("radarRing");
					radarLayers[i].removeAllFeatures();
				}
				Global.common.map.removeLayer(radarLayers[i]);
			}
		}
	}
	//雷达
	else if(Config.layerType7.indexOf(","+id+",") >= 0){
		//删除雷达圈
		var radarLayers = Global.common.map.getLayersByName("radarRing");
		if(radarLayers.length > 0){
			for(var i=0; i<radarLayers.length; i++){
				if(radarLayers[i].features){
					removeSelectFeatureLayersByName("radarRing");
					radarLayers[i].removeAllFeatures();
				}
				Global.common.map.removeLayer(radarLayers[i]);
			}
		}
	}
	//自动站实况
	else if(Config.layerType9.indexOf(","+id+",") >= 0){
		Global.common.param1 = null;
		var layers = Global.common.map.getLayersByName(Config.layerType9Name[0]);
		var layers1 = Global.common.map.getLayersByName(Config.layerType9Name[1]);
		if(layers.length > 0){
			for(var i=0; i<layers.length; i++){
				if(layers[i].features){
					removeSelectFeatureLayersByName(Config.layerType9Name[0]);
					layers[i].removeAllFeatures();
				}
				Global.common.map.removeLayer(layers[i]);
			}
		}
		if(layers1.length > 0){
			for(var i=0; i<layers1.length; i++){
				if(layers1[i].features){
					removeSelectFeatureLayersByName(Config.layerType9Name[1]);
					layers1[i].removeAllFeatures();
				}
				Global.common.map.removeLayer(layers1[i]);
			}
		}
	}
	//气候区划
	else if(Config.layerTypeJ.indexOf(","+id+",") >= 0){
		Global.common.param1 = null;
		var layers = Global.common.map.getLayersByName(Config.layerType9Name[0]);
		var layers1 = Global.common.map.getLayersByName(Config.layerType9Name[1]);
		if(layers.length > 0){
			for(var i=0; i<layers.length; i++){
				if(layers[i].features){
					removeSelectFeatureLayersByName(Config.layerType9Name[0]);
					layers[i].removeAllFeatures();
				}
				Global.common.map.removeLayer(layers[i]);
			}
		}
		if(layers1.length > 0){
			for(var i=0; i<layers1.length; i++){
				if(layers1[i].features){
					removeSelectFeatureLayersByName(Config.layerType9Name[1]);
					layers1[i].removeAllFeatures();
				}
				Global.common.map.removeLayer(layers1[i]);
			}
		}
	}
	//预警预报
	else if(Config.layerTypeYubao.indexOf(","+id+",") >= 0){
		Global.common.param1 = null;
		var layers = Global.common.map.getLayersByName(Config.layerType9Name[0]);
		var layers1 = Global.common.map.getLayersByName(Config.layerType9Name[1]);
		if(layers.length > 0){
			for(var i=0; i<layers.length; i++){
				if(layers[i].features){
					removeSelectFeatureLayersByName(Config.layerType9Name[0]);
					layers[i].removeAllFeatures();
				}
				Global.common.map.removeLayer(layers[i]);
			}
		}
		if(layers1.length > 0){
			for(var i=0; i<layers1.length; i++){
				if(layers1[i].features){
					removeSelectFeatureLayersByName(Config.layerType9Name[1]);
					layers1[i].removeAllFeatures();
				}
				Global.common.map.removeLayer(layers1[i]);
			}
		}
	}
	//格点图层
	else if(Config.layerType10.indexOf(","+id+",") >= 0){
		GribData = {};
		Config[id].valid = 0;
	}
	//地面填图
	else if(Config.layerType11.indexOf(","+id+",") >= 0){
		whole_resData = null;
	}
	if(Config[id] && Config[id].initTimeAxisFlag != null){
		Config[id].initTimeAxisFlag = true;
	}
	if(Config[id] && Config[id].value){
		Config[id].value = null;
	}
	if(Config[id] && Config[id].timeHtml){
		Config[id].timeHtml = null;
	}
	if(Config[id] && Config[id].time){
		Config[id].time = null;
	}


	refreshSelectCluster();
	removeTitle(id);
	removeTimeAxis(id);
	removeLegend(id);
	removePoiLegend(id);
	mapTitleFunc();
	
}

/**
 * @note 监测报警websocket客户端
 * @author 吴义迪
 * @create_time 2017-06-28
 *//*
function socketClient(){
	//websocket连接
	try{
		Global.common.socket = new WebSocket(Global.common.socketPath);
	}catch(e){
		window.console.log("websocket连接异常");
	}
	
	//打开Socket响应事件 
	Global.common.socket.onopen = function(event) {};
	
	//接收websocket消息
	Global.common.socket.onmessage = function(event) {
		Global.common.jcbjJsonStr = event.data;
		var flag = false;
		var array = Config.layerType1.split(",");
		for(var i=0; i<array.length; i++){
			if($("#tree_li_"+array[i]+"_img4").css("display") != "none" && $("#tree_li_"+array[i]+"_img4").css("display") != null){
				flag = true;
				break;
			}
		}
		if(flag == true){
			showJCBJInfo(Global.common.jcbjJsonStr);

		}
	};
	
	//关闭Socket响应事件 
	Global.common.socket.onclose = function(event) {};
}*/

/**
 * @note 预警信号websocket客户端
 * @author 吴义迪
 * @create_time 2017-07-13
 */
/*function yjxhSocketClient(){
	//websocket连接
	try{
		Global.common.socket1 = new WebSocket(Global.common.socketPath1);
	}catch(e){
		window.console.log("websocket连接异常");
	}
	
	//打开Socket响应事件 
	Global.common.socket1.onopen = function(event) {};
	
	//接收websocket消息
	Global.common.socket1.onmessage = function(event) {
		Global.common.yjxhJsonStr = event.data;
		//预警信息展示到菜单栏上
//		showYJXHInfoToMenu(Global.common.yjxhJsonStr);
		var flag = false;
		var array = Config.layerType8.split(",");
		for(var i=0; i<array.length; i++){
			if($("#tree_li_"+array[i]+"_img4").css("display") != "none" && $("#tree_li_"+array[i]+"_img4").css("display") != null){
				flag = true;
				break;
			}
		}
		if(flag == true && Global.common.yjxhWebSocketFlag == true){
			showYJXHInfo(Global.common.yjxhJsonStr);
		}
	};
	
	//关闭Socket响应事件 
	Global.common.socket1.onclose = function(event) {};
}*/

/**
 * @note 根据图层名清除selectFeatureLayers数组中的图层
 * @param name：图层name
 * @author 吴义迪
 * @create_time 2017-06-30
 */
function removeSelectFeatureLayersByName(name){
	for(var i=0; i<Global.common.selectFeatureLayers.length; i++){
		if(Global.common.selectFeatureLayers[i].name == name){
			Global.common.selectFeatureLayers.splice(i--, 1);
			break;
		}
	}
	Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
}

/**
 * @note 请求监测报警数据
 * @author 吴义迪
 * @create_time 2017-07-14
 */
/*function requestJCBJInfo(id){
	$.ajax({
		url: Global.common.path + "/NMWarning" + $("#tree_li_"+id+"").attr("layerUrl"),
		type: "post",
		data: {},
		dataType: "json",
		success:function(result){
			if(result.status == 1){
				Global.common.jcbjJsonStr = result.data;
				showJCBJInfo(result.data);
			}
		}
	});
}*/

/**
 * @note 请求预警信号数据
 * @author 吴义迪
 * @create_time 2017-07-14
 */
/*function requestYJXHInfo(id){
	$.ajax({
		url: Global.common.path + "/NMWarning" + $("#tree_li_"+id+"").attr("layerUrl"),
		type: "post",
		data: {},
		dataType: "json",
		success:function(result){
			if(result.status= 1){
				Global.common.yjxhJsonStr = result.data;
				//预警信息展示到菜单栏上
//				showYJXHInfoToMenu(Global.common.yjxhJsonStr);
				showYJXHInfo(Global.common.yjxhJsonStr);
			}
		}
	});
}*/

/**
 * @note 条件请求预警信号数据
 * @author 吴义迪
 * @create_time 2017-10-19
 */
/*function requestYJXHInfo1(param){
	$.ajax({
		url: Global.common.path + "/NMWarning/yjxh/requestYjxhInfo1.do",
		type: "post",
		data: param,
		dataType: "json",
		success:function(result){
			$("#yjxh_query").html("查询");
			$("#yjxh_query").attr("disabled", false);
			var value = result.data;
			Global.common.yjxhValue = value;
			showYJXHInfo2(value, true);
		}
	});
}*/

/**
 * @note 展示预警信号信息
 * @author 吴义迪
 * @create_time 2017-07-13
 */
function showYJXHInfo(jsonStr){
	if(jsonStr != null){
		var value;
		//解析json
		if(typeof jsonStr == "object"){
			value = jsonStr;
		}else{
			value = eval('('+jsonStr+')');
		}
		
		var layers = Global.common.map.getLayersByName(Config.layerType8Name[0]);
		if(layers.length > 0){
			layers[0].removeAllFeatures();
		}else{
			layers.push(new SuperMap.Layer.Vector(Config.layerType8Name[0]));
			Global.common.map.addLayer(layers[0]);
			Global.common.selectFeatureLayers.push(layers[0]);
			Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
			refreshSelectCluster();
		}
		var fs = [];
		var geometry = [];
		var level1 = 0;
		var level2 = 0;
		var level3 = 0;
		var level4 = 0;
		var areaCount1 = 0;
		var areaCount2 = 0;
		var areaCount3 = 0;
		var eventValue = [];
		var areaValue = [];
		eventValue.push({"flag":"all", "img":"resources/images/indexMap/all_blue.png", "count":value.length, "note":"全部预警"});
		areaValue.push({"code":"000000", "name":"内蒙古自治区"});
		var eventStr = "";
		var areaStr = "";
		var typeArr = [];
		var areaCode = null;
		var listValue = [];
		if($("#yjxh_dqsx_div1>span[name='yjxh_type']").length > 0){
			for(var i=0; i<$("#yjxh_dqsx_div1>span[name='yjxh_type']").length; i++){
				if($("#yjxh_dqsx_div1>span[flag='all']").attr("flag1") == "0"){
					if($("#yjxh_dqsx_div1>span[name='yjxh_type']").eq(i).attr("flag1") == "0" && $("#yjxh_dqsx_div1>span[name='yjxh_type']").eq(i).attr("flag") != "all"){
						typeArr.push($("#yjxh_dqsx_div1>span[name='yjxh_type']").eq(i).attr("flag"));
					}
				}
			}
			areaCode = $("#yjxh_dqsx_select>option:selected").attr("code");
		}
		for(var i=0; i<value.length; i++){
			if(areaStr.indexOf(value[i].id.substring(0,6)) < 0){
				areaValue.push({"code":value[i].id.substring(0,6), "name":value[i].areaname});
				areaStr += value[i].id.substring(0,6) + ",";
			}
			if(areaCode != null && areaCode != "000000"){
				if(value[i].areaCode != areaCode){
					continue;
				}
			}
			var f = new SuperMap.Feature.Vector();
			var lon = parseFloat(value[i].lon);
			var lat = parseFloat(value[i].lat);
			//处理预警信息位置相同情况
			if(geometry.length <= 0){
				geometry.push({"lon":value[i].lon, "lat":value[i].lat});
			}else{
				for(var k=0; k<geometry.length; k++){
					if(geometry[k].lon == value[i].lon && geometry[k].lat == value[i].lat){
						lon += Math.random()*0.1;
						lat += Math.random()*0.1;
						break;
					}
					if(k == (geometry.length-1)){
						geometry.push({"lon":value[i].lon, "lat":value[i].lat});
					}
				}
			}
			f.geometry = new SuperMap.Geometry.Point(lon, lat).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
			var imgFlag = "";
			var imgUrl = "";
			for(var j=0; j<Global.monitor.yjxh.length; j++){
				if(typeof value[i].title == "string" && value[i].title.indexOf(Global.monitor.yjxh[j].name) >= 0 && value[i].title.indexOf(Global.monitor.yjxh[j].level) >= 0){
					imgFlag = Global.monitor.yjxh[j].flag;
					break;
				}
			}
			for(var j=0; j<Global.monitor.imgUrl.length; j++){
				if(imgFlag == Global.monitor.imgUrl[j].name){
					imgUrl = Global.monitor.imgUrl[j].value;
					break;
				}
			}
			if(imgUrl == ""){
				if(typeof value[i].title == "string" && value[i].title.indexOf("蓝色") >= 0){
					imgUrl = "resources/images/indexMap/adefault_blue.png";
				}else if(typeof value[i].title == "string" && value[i].title.indexOf("黄色") >= 0){
					imgUrl = "resources/images/indexMap/adefault_yellow.png";
				}else if(typeof value[i].title == "string" && value[i].title.indexOf("橙色") >= 0){
					imgUrl = "resources/images/indexMap/adefault_orange.png";
				}else if(typeof value[i].title == "string" && value[i].title.indexOf("红色") >= 0){
					imgUrl = "resources/images/indexMap/adefault_red.png";
				}
			}
			if(eventStr.indexOf(value[i].eventtype + "_" + value[i].level) < 0){
				var level;
				if(value[i].level == Global.common.yjxh_level[0]){
					level = "红";
				}else if(value[i].level == Global.common.yjxh_level[1]){
					level = "橙";
				}else if(value[i].level == Global.common.yjxh_level[2]){
					level = "黄";
				}else if(value[i].level == Global.common.yjxh_level[3]){
					level = "蓝";
				}
				eventValue.push({"flag":value[i].eventtype+"_"+value[i].level, "img":imgUrl, "count":1, "note":value[i].disaster+"·"+level});
				eventStr += value[i].eventtype + "_" + value[i].level + ",";
			}else{
				for(var k=0; k<eventValue.length; k++){
					if(eventValue[k].flag == value[i].eventtype+ "_" + value[i].level){
						eventValue[k].count++;
						break;
					}
				}
			}
			
			f.style = {
				graphic: true,
				externalGraphic: imgUrl,
				graphicWidth: 24,
				graphicHeight: 24,
	        };
			f.info = {
				layerId: "yjxh",
				eventtype: value[i].eventtype,
				title: value[i].title,
				content: value[i].content,
				alertId: value[i].id,
				level: value[i].level,
				msgtype: value[i].msgtype
			};
			var typeFlag = false;
			for(var o=0; o<typeArr.length; o++){
				if(value[i].eventtype + "_" + value[i].level == typeArr[o]){
					typeFlag = true;
					break;
				}
			}
			if(typeFlag == true){
				continue;
			}
			
			fs.push(f);
			//统计分析
			if(value[i].level == Global.common.yjxh_level[0]){
				level1 ++;
			}else if(value[i].level == Global.common.yjxh_level[1]){
				level2 ++;
			}else if(value[i].level == Global.common.yjxh_level[2]){
				level3 ++;
			}else if(value[i].level == Global.common.yjxh_level[3]){
				level4 ++;
			}
			if(value[i].id.substring(2,6) == "0000"){
				areaCount1 ++;
			}else if(value[i].id.substring(4,6) == "00"){
				areaCount2 ++;
			}else{
				areaCount3 ++;
			}
			listValue.push(value[i]);
		}
		layers[0].addFeatures(fs);
		//绘制统计分析图
		$("#zhfw-yjxh-count").html(value.length);
		$("#zhfw-tjcx-count1").html(value.length);
		$("#zhfw-yjxh-count1").html(areaCount1);
		$("#zhfw-yjxh-count2").html(areaCount2);
		$("#zhfw-yjxh-count3").html(areaCount3);
		var myChart = echarts.init(document.getElementById('ring'));
        option = {
            legend: {
                orient: 'vertical',
                right: 10,
                top: 20,
                data:['红色预警','橙色预警','黄色预警','蓝色预警'],
                color: ['red', 'orange', 'yellow', 'blue'],//饼图颜色
            },
            series: [
                {
                    name:'访问来源',
                    type:'pie',
                    radius: ['40%', '60%'],
                    center: ['35%', '50%'],
                    label: {
                        normal: {
                            show: true,
                            color: '#000'
                        },
                        emphasis: {
                            show: true,
                            textStyle: {
                                fontSize: '14',
                                fontWeight: 'bold',
                                color:'#000'
                            }
                        }
                    },
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                formatter: "{c}条",
                                width: 1
                            },

                            labelLine: {
                                show: true
                            }
                        }

                    },
                    data:[
                        {value:level1, name:'红色预警'},
                        {value:level2, name:'橙色预警'},
                        {value:level3, name:'黄色预警'},
                        {value:level4, name:'蓝色预警'}
                    ],
                    color: ['red', 'orange', 'yellow', 'blue'],//饼图颜色
                }
            ]
        };
        myChart.setOption(option);
        
        //高级面板显示
        if($("#tree_li_58_advancedQueryDiv").length > 0){
        	var html = "";
        	for(var l=0; l<eventValue.length; l++){
        		var flag1 = "0";
        		if(l == 0 && typeArr.length == 0){
        			flag1 = "1";
        		}
        		if(l > 0){
        			for(var o=0; o<typeArr.length; o++){
        				if(eventValue[l].flag == typeArr[o]){
        					flag1 = "0";
        					break;
        				}
        				if(o==typeArr.length-1){
        					flag1 = "1";
        				}
        			}
        		}
        		if(l !=0 && l%3 == 0){
        			html += "<br>";
        		}
        		if(l < 3){
        			if(l == 0){
        				html += "<span name=\"yjxh_type\" flag=\""+eventValue[l].flag+"\" flag1=\""+flag1+"\" title=\""+eventValue[l].note+"\" style=\"position:relative;cursor:pointer;display:inline-block;text-align:center;width:75px;height:65px;border:1px solid #ddd;\">" +
		        				"	<img src=\""+eventValue[l].img+"\" style=\"width:36px;height:30px;display:inline-block;margin:8px 0 0 5px;\">" +
		        				"	<br>" +
		        				"	<span class=\"yjxh_span\">"+eventValue[l].note+"</span>" +
		        				"	<span class=\"yjxh_span1\">"+eventValue[l].count+"</span>" +
		        				"	<em class=\"emfocus\"></em>" +
		        				"</span>";
        			}else{
        				html += "<span name=\"yjxh_type\" flag=\""+eventValue[l].flag+"\" flag1=\""+flag1+"\" title=\""+eventValue[l].note+"\" style=\"position:relative;cursor:pointer;display:inline-block;text-align:center;width:75px;height:65px;border-top:1px solid #ddd;border-right:1px solid #ddd;border-bottom:1px solid #ddd;\">" +
		        				"	<img src=\""+eventValue[l].img+"\" style=\"width:36px;height:30px;display:inline-block;margin:8px 0 0 5px;\">" +
		        				"	<br>" +
		        				"	<span class=\"yjxh_span\">"+eventValue[l].note+"</span>" +
		        				"	<span class=\"yjxh_span1\">"+eventValue[l].count+"</span>" +
		        				"	<em class=\"emfocus\"></em>" +
		        				"</span>";
        			}
        		}else{
        			if(l % 3 == 0){
        				html += "<span name=\"yjxh_type\" flag=\""+eventValue[l].flag+"\" flag1=\""+flag1+"\" title=\""+eventValue[l].note+"\" style=\"position:relative;cursor:pointer;display:inline-block;text-align:center;width:75px;height:65px;border-left:1px solid #ddd;border-bottom:1px solid #ddd;border-right:1px solid #ddd;\">" +
		        				"	<img src=\""+eventValue[l].img+"\" style=\"width:36px;height:30px;display:inline-block;margin:8px 0 0 5px;\">" +
		        				"	<br>" +
		        				"	<span class=\"yjxh_span\">"+eventValue[l].note+"</span>" +
		        				"	<span class=\"yjxh_span1\">"+eventValue[l].count+"</span>" +
		        				"	<em class=\"emfocus\"></em>" +
		        				"</span>";
        			}else{
        				html += "<span name=\"yjxh_type\" flag=\""+eventValue[l].flag+"\" flag1=\""+flag1+"\" title=\""+eventValue[l].note+"\" style=\"position:relative;cursor:pointer;display:inline-block;text-align:center;width:75px;height:65px;border-bottom:1px solid #ddd;border-right:1px solid #ddd;\">" +
		        				"	<img src=\""+eventValue[l].img+"\" style=\"width:36px;height:30px;display:inline-block;margin:8px 0 0 5px;\">" +
		        				"	<br>" +
		        				"	<span class=\"yjxh_span\">"+eventValue[l].note+"</span>" +
		        				"	<span class=\"yjxh_span1\">"+eventValue[l].count+"</span>" +
		        				"	<em class=\"emfocus\"></em>" +
		        				"</span>";
        			}
        		}
        	}
        	if(eventValue.length < 3){
        		for(var b=0; b<3-eventValue.length; b++){
        			html += "<span style=\"background:#eee;display:inline-block;width:75px;height:65px;border-top:1px solid #ddd;border-bottom:1px solid #ddd;border-right:1px solid #ddd;\">" +
		        			"	<span class=\"yjxh_zw_span\"></span>" +
							"</span>";
        		}
        	}else{
        		for(var b=0; b<3-eventValue.length%3 && eventValue.length%3 != 0; b++){
        			html += "<span style=\"background:#eee;display:inline-block;width:75px;height:65px;border-bottom:1px solid #ddd;border-right:1px solid #ddd;\">" +
		        			"	<span class=\"yjxh_zw_span\"></span>" +
							"</span>";
        		}
        	}
        	$("#yjxh_dqsx_div1").html(html);
        	
        	var html1 = "";
        	for(var a=0; a<areaValue.length; a++){
        		if(areaValue[a].code == "150000"){
        			areaValue[a].name = "省级";
        		}
        		if(areaValue[a].code == areaCode && areaCode != null){
        			html1 += "<option code=\""+areaValue[a].code+"\" selected=\"selected\">"+areaValue[a].name+"</option>";
        		}else{
        			html1 += "<option code=\""+areaValue[a].code+"\">"+areaValue[a].name+"</option>";
            	}
        		}
        	$("#yjxh_dqsx_select").html(html1);
        	$("#zhfw-yjxh-area").html($("#yjxh_dqsx_select>option:selected").html()+"当前生效");
        	$("#zhfw-yjxh-area1").html($("#yjxh_dqsx_select>option:selected").html()+"当前生效");
        	for(var i=0; i<$("#yjxh_dqsx_div1>span[name='yjxh_type']").length; i++){
				if($("#yjxh_dqsx_div1>span[name='yjxh_type']").eq(i).attr("flag1") == "0"){
					$("#yjxh_dqsx_div1>span[name='yjxh_type']").eq(i).children(".emfocus").hide();
				}else{
					$("#yjxh_dqsx_div1>span[name='yjxh_type']").eq(i).children(".emfocus").show();
				}
			}
        }
        setAdvancedQueryDivTop($("#tree_li_58_img5"), $("#tree_li_58_advancedQueryDiv"));
        //加载预警信息列表
        loadYjxhList(listValue);
	}
}

/**
 * @note 展示条件预警信号信息
 * @author 吴义迪
 * @create_time 2017-10-19
 */
function showYJXHInfo2(value, showFlag){
	var layers = Global.common.map.getLayersByName(Config.layerType8Name[0]);
	if(layers.length > 0){
		layers[0].removeAllFeatures();
	}else{
		layers.push(new SuperMap.Layer.Vector(Config.layerType8Name[0]));
		Global.common.map.addLayer(layers[0]);
		Global.common.selectFeatureLayers.push(layers[0]);
		Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
		refreshSelectCluster();
	}
	var fs = [];
	var geometry = [];
	var level1 = 0;
	var level2 = 0;
	var level3 = 0;
	var level4 = 0;
	var areaCount1 = 0;
	var areaCount2 = 0;
	var areaCount3 = 0;
	var eventValue = [];
	var eventStr = "";
	if(value != null){
		eventValue.push({"flag":"all", "img":"resources/images/indexMap/all_blue.png", "count":value.length, "note":"全部预警"});
		for(var i=0; i<value.length; i++){
			var f = new SuperMap.Feature.Vector();
			var lon = parseFloat(value[i].lon);
			var lat = parseFloat(value[i].lat);
			//处理预警信息位置相同情况
			if(geometry.length <= 0){
				geometry.push({"lon":value[i].lon, "lat":value[i].lat});
			}else{
				for(var k=0; k<geometry.length; k++){
					if(geometry[k].lon == value[i].lon && geometry[k].lat == value[i].lat){
						lon += Math.random()*0.1;
						lat += Math.random()*0.1;
						break;
					}
					if(k == (geometry.length-1)){
						geometry.push({"lon":value[i].lon, "lat":value[i].lat});
					}
				}
			}
			f.geometry = new SuperMap.Geometry.Point(lon, lat).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
			var imgFlag = "";
			var imgUrl = "";
			for(var j=0; j<Global.monitor.yjxh.length; j++){
				if(typeof value[i].title == "string" && value[i].title.indexOf(Global.monitor.yjxh[j].name) >= 0 && value[i].title.indexOf(Global.monitor.yjxh[j].level) >= 0){
					imgFlag = Global.monitor.yjxh[j].flag;
					break;
				}
			}
			for(var j=0; j<Global.monitor.imgUrl.length; j++){
				if(imgFlag == Global.monitor.imgUrl[j].name){
					imgUrl = Global.monitor.imgUrl[j].value;
					break;
				}
			}
			if(imgUrl == ""){
				if(typeof value[i].title == "string" && value[i].title.indexOf("蓝色") >= 0){
					imgUrl = "resources/images/indexMap/adefault_blue.png";
				}else if(typeof value[i].title == "string" && value[i].title.indexOf("黄色") >= 0){
					imgUrl = "resources/images/indexMap/adefault_yellow.png";
				}else if(typeof value[i].title == "string" && value[i].title.indexOf("橙色") >= 0){
					imgUrl = "resources/images/indexMap/adefault_orange.png";
				}else if(typeof value[i].title == "string" && value[i].title.indexOf("红色") >= 0){
					imgUrl = "resources/images/indexMap/adefault_red.png";
				}
			}
			if(eventStr.indexOf(value[i].eventtype + "_" + value[i].level) < 0){
				var level;
				if(value[i].level == Global.common.yjxh_level[0]){
					level = "红";
				}else if(value[i].level == Global.common.yjxh_level[1]){
					level = "橙";
				}else if(value[i].level == Global.common.yjxh_level[2]){
					level = "黄";
				}else if(value[i].level == Global.common.yjxh_level[3]){
					level = "蓝";
				}
				eventValue.push({"flag":value[i].eventtype+"_"+value[i].level, "img":imgUrl, "count":1, "note":value[i].disaster+"·"+level});
				eventStr += value[i].eventtype + "_" + value[i].level + ",";
			}else{
				for(var k=0; k<eventValue.length; k++){
					if(eventValue[k].flag == value[i].eventtype+ "_" + value[i].level){
						eventValue[k].count++;
						break;
					}
				}
			}
			
			f.style = {
				graphic: true,
				externalGraphic: imgUrl,
				graphicWidth: 24,
				graphicHeight: 24,
	        };
			f.info = {
				layerId: "yjxh",
				eventtype: value[i].eventtype,
				title: value[i].title,
				content: value[i].content,
				alertId: value[i].id,
				level: value[i].level,
				msgtype: value[i].msgtype
			};
			fs.push(f);
			//统计分析
			if(value[i].level == Global.common.yjxh_level[0]){
				level1 ++;
			}else if(value[i].level == Global.common.yjxh_level[1]){
				level2 ++;
			}else if(value[i].level == Global.common.yjxh_level[2]){
				level3 ++;
			}else if(value[i].level == Global.common.yjxh_level[3]){
				level4 ++;
			}
			if(value[i].id.substring(2,6) == "0000"){
				areaCount1 ++;
			}else if(value[i].id.substring(4,6) == "00"){
				areaCount2 ++;
			}else{
				areaCount3 ++;
			}
		}
		layers[0].addFeatures(fs);
	}
	//绘制统计分析图
	if(value == null){
		$("#zhfw-yjxh-count").html(0);
		$("#zhfw-tjcx-count1").html(0);
	}else{
		$("#zhfw-yjxh-count").html(value.length);
		$("#zhfw-tjcx-count1").html(value.length);
	}
	$("#zhfw-yjxh-count1").html(areaCount1);
	$("#zhfw-yjxh-count2").html(areaCount2);
	$("#zhfw-yjxh-count3").html(areaCount3);
	var myChart = echarts.init(document.getElementById('ring'));
    option = {
        legend: {
            orient: 'vertical',
            right: 10,
            top: 20,
            data:['红色预警','橙色预警','黄色预警','蓝色预警'],
            color: ['red', 'orange', 'yellow', 'blue'],//饼图颜色
        },
        series: [
            {
                name:'访问来源',
                type:'pie',
                radius: ['40%', '60%'],
                center: ['35%', '50%'],
                label: {
                    normal: {
                        show: true,
                        color: '#000'
                    },
                    emphasis: {
                        show: true,
                        textStyle: {
                            fontSize: '14',
                            fontWeight: 'bold',
                            color:'#000'
                        }
                    }
                },
                itemStyle: {
                    normal: {
                        label: {
                            show: true,
                            formatter: "{c}条",
                            width: 1
                        },

                        labelLine: {
                            show: true
                        }
                    }

                },
                data:[
                    {value:level1, name:'红色预警'},
                    {value:level2, name:'橙色预警'},
                    {value:level3, name:'黄色预警'},
                    {value:level4, name:'蓝色预警'}
                ],
                color: ['red', 'orange', 'yellow', 'blue'],//饼图颜色
            }
        ]
    };
    myChart.setOption(option);
    
    //高级面板显示
    if(showFlag == true){
    	var html = "";
    	for(var l=0; l<eventValue.length; l++){
    		var flag1 = "0";
    		if(l == 0){
    			flag1 = "1";
    		}
    		if(l !=0 && l%4 == 0){
    			html += "<br>";
    		}
    		if(l < 4){
    			if(l == 0){
    				html += "<span name=\"yjxh_type\" flag=\""+eventValue[l].flag+"\" flag1=\""+flag1+"\" title=\""+eventValue[l].note+"\" style=\"position:relative;cursor:pointer;display:inline-block;text-align:center;width:75px;height:65px;border:1px solid #ddd;\">" +
	        				"	<img src=\""+eventValue[l].img+"\" style=\"width:36px;height:30px;display:inline-block;margin:8px 0 0 5px;\">" +
	        				"	<br>" +
	        				"	<span class=\"yjxh_span\">"+eventValue[l].note+"</span>" +
	        				"	<span class=\"yjxh_span1\">"+eventValue[l].count+"</span>" +
	        				"	<em class=\"emfocus\"></em>" +
	        				"</span>";
    			}else{
    				html += "<span name=\"yjxh_type\" flag=\""+eventValue[l].flag+"\" flag1=\""+flag1+"\" title=\""+eventValue[l].note+"\" style=\"position:relative;cursor:pointer;display:inline-block;text-align:center;width:75px;height:65px;border-top:1px solid #ddd;border-right:1px solid #ddd;border-bottom:1px solid #ddd;\">" +
	        				"	<img src=\""+eventValue[l].img+"\" style=\"width:36px;height:30px;display:inline-block;margin:8px 0 0 5px;\">" +
	        				"	<br>" +
	        				"	<span class=\"yjxh_span\">"+eventValue[l].note+"</span>" +
	        				"	<span class=\"yjxh_span1\">"+eventValue[l].count+"</span>" +
	        				"	<em class=\"emfocus\"></em>" +
	        				"</span>";
    			}
    		}else{
    			if(l % 4 == 0){
    				html += "<span name=\"yjxh_type\" flag=\""+eventValue[l].flag+"\" flag1=\""+flag1+"\" title=\""+eventValue[l].note+"\" style=\"position:relative;cursor:pointer;display:inline-block;text-align:center;width:75px;height:65px;border-left:1px solid #ddd;border-bottom:1px solid #ddd;border-right:1px solid #ddd;\">" +
	        				"	<img src=\""+eventValue[l].img+"\" style=\"width:36px;height:30px;display:inline-block;margin:8px 0 0 5px;\">" +
	        				"	<br>" +
	        				"	<span class=\"yjxh_span\">"+eventValue[l].note+"</span>" +
	        				"	<span class=\"yjxh_span1\">"+eventValue[l].count+"</span>" +
	        				"	<em class=\"emfocus\"></em>" +
	        				"</span>";
    			}else{
    				html += "<span name=\"yjxh_type\" flag=\""+eventValue[l].flag+"\" flag1=\""+flag1+"\" title=\""+eventValue[l].note+"\" style=\"position:relative;cursor:pointer;display:inline-block;text-align:center;width:75px;height:65px;border-bottom:1px solid #ddd;border-right:1px solid #ddd;\">" +
	        				"	<img src=\""+eventValue[l].img+"\" style=\"width:36px;height:30px;display:inline-block;margin:8px 0 0 5px;\">" +
	        				"	<br>" +
	        				"	<span class=\"yjxh_span\">"+eventValue[l].note+"</span>" +
	        				"	<span class=\"yjxh_span1\">"+eventValue[l].count+"</span>" +
	        				"	<em class=\"emfocus\"></em>" +
	        				"</span>";
    			}
    		}
    	}
    	if(eventValue.length < 4 && eventValue.length > 0){
    		for(var b=0; b<4-eventValue.length; b++){
    			html += "<span style=\"background:#eee;display:inline-block;width:75px;height:65px;border-top:1px solid #ddd;border-bottom:1px solid #ddd;border-right:1px solid #ddd;\">" +
	        			"	<span class=\"yjxh_zw_span\"></span>" +
						"</span>";
    		}
    	}else{
    		for(var b=0; b<4-eventValue.length%4 && eventValue.length%4 != 0; b++){
    			html += "<span style=\"background:#eee;display:inline-block;width:75px;height:65px;border-bottom:1px solid #ddd;border-right:1px solid #ddd;\">" +
	        			"	<span class=\"yjxh_zw_span\"></span>" +
						"</span>";
    		}
    	}
    	$("#yjxh_tjcx_div1").html(html);
    	$("#yjxh_tjcx_div").css("height", $("#yjxh_tjcx_div1").height() + "px");
    	$("#zhfw-yjxh-area").html("条件查询");
    	$("#zhfw-yjxh-area1").html("条件查询");
    	
    	for(var i=0; i<$("#yjxh_tjcx_div1>span[name='yjxh_type']").length; i++){
			if($("#yjxh_tjcx_div1>span[name='yjxh_type']").eq(i).attr("flag1") == "0"){
				$("#yjxh_tjcx_div1>span[name='yjxh_type']").eq(i).children(".emfocus").hide();
			}else{
				$("#yjxh_tjcx_div1>span[name='yjxh_type']").eq(i).children(".emfocus").show();
			}
		}
    }
    setAdvancedQueryDivTop($("#tree_li_58_img5"), $("#tree_li_58_advancedQueryDiv"));
    //加载预警信息列表
    loadYjxhList(value);
}

/**
 * @note 预警信号列表显示
 * @author 吴义迪
 * @create_time 2017-10-19
 */
function yjxhListShow(){
	$("#warning-info-count").hide();
	$("#warning-info-list").show();
}

/**
 * @note 预警信号统计显示
 * @author 吴义迪
 * @create_time 2017-10-19
 */
function yjxhCountShow(){
	$("#warning-info-count").show();
	$("#warning-info-list").hide();
}

/**
 * @note 加载预警信息表格
 * @author 吴义迪
 * @create_time 2017-10-18
 */
function loadYjxhList(value){
	if(value == null){
		$("#gridTable_yjxh").jqGrid("clearGridData");
	}else{
		//初始化表格，后续无需再执行
		if($("#gridTable_yjxh>tbody").length == 0){
			$("#gridTable_yjxh").jqGrid({
		        datatype: "local",
		        data: value,
		        width: 600,
		        height: 300,
		       	loadonce : true,	//表示数据为一次性加载完毕，进行表头排序时需要此属性设为true
		        rownumbers: true,	//表格增加排序列
		        colNames:['预警标题', "发布时间", "预警内容"],
		        colModel:[
		                    //sortable: true	该表格列可排序
		                    //hidden:true		表格初始化时隐藏改列
		                    {name:'title',index:'title',align:"left"},
		                    {name:'id',index:'id',align:"left",formatter:function(value1,options,rowData){
		                    	if(typeof value1 == "string"){
		                    		return value1.substring(15,19) + "-" + value1.substring(19,21) + "-" + 
		                    		value1.substring(21,23) + " " + value1.substring(23,25) + ":" + value1.substring(25,27) +
		                    		":" + value1.substring(27,29);
		                    	}else{
		                    		return value1;
		                    	}
		                    }},
		                    {name:'content',index:'content',align:"left"}
		                 ],
		        viewrecords:true,
		        styleUI: 'Bootstrap',
		        rowNum: 8,
		        pager:"#gridPager_yjxh",
		        hidegrid : false,
		        onSelectRow:function(rowid){   
					var rowDatas = $("#gridTable_yjxh").jqGrid('getRowData', rowid);
					var id = rowDatas["id"];
					var layers = Global.common.map.getLayersByName(Config.layerType8Name[0]);
					if(layers.length > 0){
						for(var p=0; p<layers[0].features.length; p++){
							var value1 = layers[0].features[p].info.alertId;
							if(value1.substring(15,19) + "-" + value1.substring(19,21) + "-" + 
                    		   value1.substring(21,23) + " " + value1.substring(23,25) + ":" + value1.substring(25,27) +
                    		   ":" + value1.substring(27,29) == id){
								openYJXHPopup(layers[0].features[p]);
								Global.common.map.setCenter(new SuperMap.LonLat(layers[0].features[p].geometry.x, layers[0].features[p].geometry.y).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+""), 10);
								break;
							}
						}
					}
				},
		    });
		}else{
			$("#gridTable_yjxh").jqGrid("clearGridData");
			//重新加载数据
			$("#gridTable_yjxh").setGridParam({
				data: value
			}).trigger("reloadGrid");
		}
	}
}

/**
 * @note 展示预警信号信息到菜单栏上
 * @author 吴义迪
 * @create_time 2017-08-02
 */
function showYJXHInfoToMenu(jsonStr){
	if(Global.common.yjxhFlag == true){
		Global.common.yjxhFlag = false;
		// yangjunwei.com
	    // Web_Announce：滚动一行停顿3秒,再滚动下一行
	    function ann_marquee(lh, speed, delay) {
	        // 参数：lh为行高line-height，speed为滚动速度，delay为延迟、停顿的时间
	        var p = false;
	        var t;
	        var o = window.parent.document.getElementById("ann_box");
	        o.innerHTML += o.innerHTML;
	        o.style.marginTop = 0;
	        o.onmouseover = function () {
	            p = true;
	        };
	        o.onmouseout = function () {
	            p = false;
	        };
	        function start() {
	            t = setInterval(scrolling, speed);
	            if (!p) o.style.marginTop = parseInt(o.style.marginTop) - 1 + "px";
	        }

	        function scrolling() {
	            if (parseInt(o.style.marginTop) % lh != 0) {
	                o.style.marginTop = parseInt(o.style.marginTop) - 1 + "px";
	                if (Math.abs(parseInt(o.style.marginTop)) >= o.scrollHeight / 2) o.style.marginTop = 0;
	            } else {
	                clearInterval(t);
	                setTimeout(start, delay);
	            }
	        }

	        setTimeout(start, delay);
	    }
	    ann_marquee(31, 10, 3000);
	}
	if(jsonStr != null){
		var value;
		//解析json
		if(typeof jsonStr == "object"){
			value = jsonStr;
		}else{
			value = eval('('+jsonStr+')');
		}
		var html = "";
		for(var i=0; i<value.length; i++){
			var imgFlag = "";
			var imgUrl = "resources/images/indexMap/shachengbao_yellow.jpg";
			for(var j=0; j<Global.monitor.yjxh.length; j++){
				if(typeof value[i].title == "string" && value[i].title.indexOf(Global.monitor.yjxh[j].name) >= 0 && value[i].title.indexOf(Global.monitor.yjxh[j].level) >= 0){
					imgFlag = Global.monitor.yjxh[j].flag;
					break;
				}
			}
			for(var j=0; j<Global.monitor.imgUrl.length; j++){
				if(imgFlag == Global.monitor.imgUrl[j].name){
					imgUrl = Global.monitor.imgUrl[j].value;
					break;
				}
			}
			html += "<p><img src=\""+imgUrl+"\">"+value[i].title+"</p>";
		}
		html += html;
		$("#ann_box",window.parent.document).html(html);
	}
}

/**
 * @note 展示监测报警信息
 * @author 吴义迪
 * @create_time 2017-06-28
 */
function showJCBJInfo(jsonStr){
	var grouping = "";
	var array = Config.layerType1.split(",");
	for(var i=0; i<array.length; i++){
		if($("#tree_li_"+array[i]+"_img4").css("display") != "none" && $("#tree_li_"+array[i]+"_img4").css("display") != null){
			grouping = grouping + Config[array[i]].flag + ",";
		}
	}
	if(grouping == ""){
		var layers = Global.common.map.getLayersByName(Config.layerType1Name[0]);
		if(layers.length > 0){
			removeSelectFeatureLayersByName(Config.layerType1Name[0]);
			layers[0].removeAllFeatures();
			Global.common.map.removeLayer(layers[0]);
		}
		return;
	}
	if(jsonStr != null){
		var value;
		//解析json
		if(typeof jsonStr == "object"){
			value = jsonStr;
		}else{
			value = eval('('+jsonStr+')');
		}
		var layers = Global.common.map.getLayersByName(Config.layerType1Name[0]);
		if(layers.length > 0){
			layers[0].removeAllFeatures();
		}else{
			layers.push(new SuperMap.Layer.Vector(Config.layerType1Name[0]));
			Global.common.map.addLayer(layers[0]);
			Global.common.selectFeatureLayers.push(layers[0]);
			Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
			refreshSelectCluster();
		}
		var fs = [];
		var stationStr = "";
		for(var i=0; i<value.length; i++){
			if(grouping.indexOf(value[i].warnType.grouping) < 0){
				continue;
			}
			if(stationStr.indexOf(value[i].stationId) > -1){
				continue;
			}else{
				stationStr = stationStr + value[i].stationId + ",";
			}
			var f = new SuperMap.Feature.Vector();
			var lon = null;
			var lat = null;
			var stationName = null;
			var loopFlag = false;
			var imgUrl = "";
			var rotation = 0;
			var imgWidth = 30;
			var imgHeight = 30;
			for(var j=0; j<Global.common.areaStationArr.length; j++){
				if(value[i].stationId == Global.common.areaStationArr[j].Station_Id_C){
					lon = Global.common.areaStationArr[j].Lon;
					lat = Global.common.areaStationArr[j].Lat;
					stationName = Global.common.areaStationArr[j].Station_Name;
					if((value[i].warnType.areaName.indexOf(Global.common.areaCode.substring(0,4)) < 0) || (Global.common.areaCode != "150000" && (Global.common.areaStationArr[j]["Admin_Code_CHN"] == "" || Global.common.areaStationArr[j]["Admin_Code_CHN"].indexOf(Global.common.areaCode.substring(0,4)) < 0))){
						break;
					}
					loopFlag = true;
					break;
				}
			}
			if(loopFlag == false){
				continue;
			}
			f.geometry = new SuperMap.Geometry.Point(lon, lat).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
			for(var j=0; j<Global.monitor.imgUrl.length; j++){
				if(value[i].warnType.warnCode == Global.monitor.imgUrl[j].name){
					imgUrl = Global.monitor.imgUrl[j].value;
					imgWidth = Global.monitor.imgUrl[j].width;
					imgHeight = Global.monitor.imgUrl[j].height;
					if(Global.monitor.imgUrl[j].rotation == true && (value[i].warnType.grouping == "2MinAvgWinMonitor" || value[i].warnType.grouping == "10MinAvgWinMonitor")){
						rotation = value[i].warnValue1.split(",")[0];
					}
					break;
				}
			}
			f.style = {
				graphic: true,
				externalGraphic: imgUrl,
				graphicWidth: imgWidth,
				graphicHeight: imgHeight,
				rotation: rotation
	        };
			f.info = {
				layerId: "jcbj",
				stationName: stationName,
				stationId: value[i].stationId,
				lon: lon,
				lat: lat,
				observTimes: value[i].observTimes,
				warnValue: value[i].warnValue,
				warnValue1: value[i].warnValue1,
				warnType: value[i].warnType.name,
				grouping: value[i].warnType.grouping,
				unit: value[i].warnType.unit
			};
			fs.push(f);
		}
		layers[0].addFeatures(fs);
	}
}

/**
 * @note 加载区域站点
 * @author 吴义迪
 * @create_time 2017-06-28
 */
function initStationByArea(){
	$.ajax({
		url: "http://127.0.0.1:8088/baseframeworkweb/cimiss/requestStationInfoByArea.do",
		type: "post",
		async: false, 
		dataType: "json",
		scriptCharset: "utf-8",
		success:function(result){
			var jsonStr = result.data;
			// if( jsonStr !== "" && jsonStr !== null ){
				var resData = JSON.parse(jsonStr);
				for(var i=0; i<resData.DS.length; i++){
					var obj = {};
					obj["Station_Id_C"] = resData.DS[i]["Station_Id_C"];
					obj["Station_Name"] = resData.DS[i]["Station_Name"];
					obj["City"] = resData.DS[i]["City"];
					obj["Lat"] = resData.DS[i]["Lat"];
					obj["Lon"] = resData.DS[i]["Lon"];
					obj["Admin_Code_CHN"] = resData.DS[i]["Admin_Code_CHN"];
					obj["Station_levl"] = resData.DS[i]["Station_levl"];
					Global.common.areaStationArr.push(obj);
					if(resData.DS[i]["Station_levl"] == "11" || resData.DS[i]["Station_levl"] == "12" || resData.DS[i]["Station_levl"] == "13"){
						Global.common.areaGjStationArr.push(obj);
					}
					if(Global.common.areaCode != null && Global.common.areaCode != "150000" && Global.common.areaCode.substring(0, 4) == obj["Admin_Code_CHN"].substring(0, 4)){
						Global.common.currAreaStationArr.push(obj);
					}
				}
			// }			
		}
	});
}

/**
 * @note 绘制监测报警类型页面
 * @author 吴义迪
 * @create_time 2017-06-29
 */
function drawWarnType(){
	var value = Global.monitor.jcbj;
	var html1 = "";
	var html2 = "";
	if(value && value.length > 0){
		html1 += "<div id=\"setYuZhi_jcbj\" class=\"setYuZhi_div\">";
		html1 += "<div class=\"setYuZhi_div_header\"><span class=\"setYuZhi_div_header_span\">实况报警阈值设置</span><span id=\"setYuZhi_div_exit\">×<span></div>";
		html1 += "<table class=\"setYuZhi_table\">";
		html2 += "<table class=\"yuZhiLegend_table\"><tr style=\"color:#fff;\"><td style=\"background:#3881DF;\">实况报警阈值</td><td style=\"background:#1852A3;\">蓝</td><td style=\"background:#EE7B1E;\">橙</td><td style=\"background:#C30E21;\">红</td></tr>";
		for(var i=0; i<value.length; i++){
			html1 += "<tr id=\"setYuZhi_"+value[i].flag+"_tr\"><td>"+value[i].name+"("+value[i].unit+")</td></tr>";
			html2 += "<tr id=\"yuZhiLegend_"+value[i].flag+"_tr\"><td>"+value[i].name+"("+value[i].unit+")</td></tr>";
		}
		html1 += "</table>";
		html2 += "</table>";
		html1 += "<input type=\"button\" value=\"确 认\" id=\"setYuZhi_confirm\" class=\"blue_button\"/>";
		html1 += "<input type=\"button\" value=\"重 置\" id=\"setYuZhi_cancel\" style=\"margin-left:5px;\" class=\"blue_button\"/>";
		html1 += "</div>";
		$("body").append(html1);
		$("#yuZhiLegend_main").html(html2);
	}
}

/**
 * @note 请求监测报警类型
 * @author 吴义迪
 * @create_time 2017-06-29
 */
function requestWarnType(){
	$.ajax({
		url: Global.common.ajaxPath1 + "/NMWarning/monitor/requestWarnType.do",
		async: false,
		type: "post",
		data: {areaName:Global.common.areaCode},
		dataType: "json",
		//回调函数
		success:function(result){
			var status = result.status;
			var value = result.data;
			//成功返回
			if(status == 1){
				$(".setYuZhi_td").remove();
				Global.common.warnType = value;
				for(var i=0; i<value.length; i++){
					if($("#setYuZhi_"+value[i].grouping+"_tr")){
						var html = "<td id=\""+value[i].warnCode+"\" class=\"setYuZhi_td\"><span>"+value[i].name+"</span> <input lowerLimit=\""+value[i].lowerLimit+"\" upperLimit=\""+value[i].upperLimit+"\" class=\"setYuZhi_input\" type=\"text\" value=\"["+value[i].lowerLimit+","+value[i].upperLimit+")\"/></td>";
						$("#setYuZhi_"+value[i].grouping+"_tr").append(html);
					}
				}
				$("#setYuZhi_confirm").css({margin:"3px 0 3px "+(($(".setYuZhi_div").outerWidth()-$("#setYuZhi_confirm").outerWidth()-$("#setYuZhi_cancel").outerWidth()-5)/2)+"px"});
				positionMapCenter($(".setYuZhi_div"));
			}else if(status == 0){	//返回失败
				
			}
		},
		error:function(){
			//异常处理
			window.console.log("请求监测报警类型异常");
		}
	});
}

/**
 * @note 显示阈值图例
 * @author 吴义迪
 * @create_time 2017-06-29
 */
function showYuZhiLegend(value){
	$(".yuZhi_td").remove();
	var array = Config.layerType1.split(",");
	var flag = false;
	for(var i=0; i<array.length; i++){
		if($("#tree_li_"+array[i]+"_img4").css("display") != "none" && $("#tree_li_"+array[i]+"_img4").css("display") != null){
			$("#yuZhiLegend_"+Config[array[i]].flag+"_tr").show();
			flag = true;
		}else if(Config[array[i]]){
			$("#yuZhiLegend_"+Config[array[i]].flag+"_tr").hide();
		}
	}
	if(flag == false){
		$("#yuZhiLegend").hide();
	}else{
		$("#yuZhiLegend").show();
	}
	for(var i=0; i<value.length; i++){
		if($("#yuZhiLegend_"+value[i].grouping+"_tr")){
			var html = "<td id=\"yuZhiLegend_"+value[i].warnCode+"\" class=\"yuZhi_td\"><span>["+value[i].lowerLimit+","+value[i].upperLimit+")</span></td>";
			$("#yuZhiLegend_"+value[i].grouping+"_tr").append(html);
		}
	}
}

/**
 * @note 修改阈值
 * @author 吴义迪
 * @create_time 2017-12-06
 */
function updateYuZhi(){
	var flag = true;
	var html = "[";
	$(".setYuZhi_table tr").each(function(){
		$("#"+this.id+" td:gt(0)").each(function(){
			var value = $("#"+this.id+">input").val();
			var value1 = value.substring(1,value.length-1);
			if(value.charAt(0) != "[" || value.charAt(value.length-1) != ")" || value.split(",").length != 2 || isNaN(value1.split(",")[0]) || isNaN(value1.split(",")[1])){
				flag = false;
				$("#"+this.id+">input").css("border", "1px solid #f00");
				$("#"+this.id+">input").css("color", "#f00");
				$("#"+this.id+">input").val("格式错误");
				return;
			}else{
				value = value.substring(1,value.length-1);
			}
			html += "{";
			html += "param1:" + "'" + this.id + "'" + "," + "param2:" + "'" + value + "'";
			html += "},";
		})
	});
	html = rTrimCharFunc(html, ",");
	html += "]";
	if(flag == false){
		alert("阈值格式修改错误！");
		return;
	}
	$.ajax({
		url: Global.common.ajaxPath1 + "/NMWarning/monitor/updateYuZhi.do",
		type: "post",
		data: {param:html, areaCode:Global.common.areaCode},
		dataType: "json",
		//回调函数
		success:function(result){
			var status = result.status;
			if(status == 1){
				alert("更改成功");
			}else{
				alert("更改失败");
			}
			requestWarnType();
			showYuZhiLegend(Global.common.warnType);
		},
		error:function(){
			//异常处理
			window.console.log("修改阈值异常");
		}
	});
}

/**
 * @note 请求父节点下的所有子节点（图层）
 * @param fid：父节点id
 * @author 吴义迪
 * @create_time 2016-11-21
 */
function requestAllLayersByFid(fid, str){
	$(".scrollContentDiv").empty();
	$.ajax({
		url: Global.common.ajaxPath+"/tree/requestAllLayersByFid.do",
		type: "post",
		data: {"fid":fid},
		dataType: "json",
		//回调函数
		success:function(result){
			var layers = result.data;
			//alert(layers);
			var html = "";
			if(layers != null && layers.length > 0){
				for(var i=0; i<layers.length; i++){
					 if(layers[i].layerId !=42 && layers[i].layerId !=43 && layers[i].fid !=42 && layers[i].fid !=43){ //隐藏灾情和农情调查
						var opacity = 100;
						if(Config[layers[i].layerId] && Config[layers[i].layerId].opacity){
							opacity = Config[layers[i].layerId].opacity;
						}
						//设置左内边距
						if(layers[i].ifNextLevel == 1){
							html = "<div class=\"panel-group\" id=\"tree_div_"+layers[i].layerId+"\" role=\"tablist\" aria-multiselectable=\"true\">" +
									"	<div class=\"panel panel-default\">" +
									"		<div class=\"panel-head\" role=\"tab\" id=\"tree_li_"+layers[i].layerId+"\">" +
									"			<h4 class=\"panel-title\">" +
									"				<a class=\"collapsed\" role=\"button\" data-toggle=\"collapse\" data-parent=\"#tree_div_"+layers[i].layerId+"\" href=\"#tree_div1_"+layers[i].layerId+"\" aria-expanded=\"false\" aria-controls=\"collapseTwo\">" +
									"					<span class=\"up_down glyphicon glyphicon-menu-down\"></span>" +
									"					<span class=\"body-tit-text\">"+layers[i].layerName+"</span>" +
									"				</a>" +
									"			</h4>" +
									"		</div>" +
									"		<div id=\"tree_div1_"+layers[i].layerId+"\" class=\"panel-collapse collapse\" role=\"tabpanel\" aria-labelledby=\"tree_li_"+layers[i].layerId+"\">" +
									"			<div id=\"tree_ul_"+layers[i].layerId+"\" class=\"panel-body\">" +
									"			</div>" +
									"		</div>" +
									"	</div>" +
									"</div>";
						}else if(layers[i].ifNextLevel == 0){
							html = "<div class=\"check_box\" id=\"tree_li_"+layers[i].layerId+"\">" +
									   "	<img id=\"tree_li_"+layers[i].layerId+"_img3\" src=\"resources/images/kuang.png\" class=\"tree_li_img3\"/>" +
									   "	<img id=\"tree_li_"+layers[i].layerId+"_img4\" src=\"resources/images/kuangchecked.png\" class=\"tree_li_img4\"/>" +
									"	<b class=\"check_text\">"+layers[i].layerName+"</b>";
							if(layers[i].setting == "1"){   
								html += "<img id=\"tree_li_"+layers[i].layerId+"_img5\" src=\"resources/images/gaoji.png\" class=\"tree_li_img5\"/>";
							}
							html += "</div>" +
									"<div id=\"tree_ul_"+layers[i].layerId+"\"></div>";
						}
						if($("#tree_ul_"+layers[i].fid).length > 0){
							$("#tree_ul_"+layers[i].fid).append(html);
						}else{
							$("#"+str+"").append(html);
						}
						//将信息赋值到li的属性中
						$("#tree_li_"+layers[i].layerId+"").attr("layerId", layers[i].layerId);
						$("#tree_li_"+layers[i].layerId+"").attr("layerName", layers[i].layerName);
						$("#tree_li_"+layers[i].layerId+"").attr("level", layers[i].lLevel);
						$("#tree_li_"+layers[i].layerId+"").attr("fid", layers[i].fid);
						$("#tree_li_"+layers[i].layerId+"").attr("timeAxis", layers[i].timeAxis);
						$("#tree_li_"+layers[i].layerId+"").attr("ifTable", layers[i].ifTable);
						$("#tree_li_"+layers[i].layerId+"").attr("grade", layers[i].grade);
						$("#tree_li_"+layers[i].layerId+"").attr("layerType", layers[i].layerType);
						$("#tree_li_"+layers[i].layerId+"").attr("showType", layers[i].showType);
						$("#tree_li_"+layers[i].layerId+"").attr("layerUrl", layers[i].layerUrl);
						$("#tree_li_"+layers[i].layerId+"").attr("popupUrl", layers[i].popupUrl);
						$("#tree_li_"+layers[i].layerId+"").attr("ifNextLevel", layers[i].ifNextLevel);
						$("#tree_li_"+layers[i].layerId+"").attr("opacity", opacity);
					 }					
				}
				//默认加载图层
				for(var i=0; i<layers.length; i++){
					if(layers[i].checked == 1){
						if(layers[i].ifNextLevel == 0){
							$("#tree_li_"+layers[i].id+"_img3").toggle();
							$("#tree_li_"+layers[i].id+"_img4").toggle();
							//加载图层
							loadLayer(layers[i].id);
						}else{
							$("#tree_div1_"+layers[i].id+"").addClass("in");
							$("#tree_li_"+layers[i].id+"").addClass("active1");
						}
					}
				}
				
				$(".panel-collapse .collapse").off();
				$(".scrollContentDiv").off("click", treeClickFunc);
				$(".scrollContentDiv").on("click", treeClickFunc);
				$(".panel-collapse .collapse").on("show.bs.collapse", function(){
					$(this).siblings().find(".glyphicon-menu-down").addClass("glyphicon-menu-up");
					$(this).siblings().addClass("active1");
				});
				$(".panel-collapse .collapse").on("hide.bs.collapse", function (){
					$(this).siblings().find(".glyphicon-menu-down").removeClass("glyphicon-menu-up");
					$(this).siblings().removeClass("active1");
				});
				//初始加载气象专题数据
				var ztFlag = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']").attr("id");
			}
		},
		error:function(){
			//异常处理
			window.console.log("请求子节点异常");
		}
	});
}

/**
 * @note 根据条件请求图例
 * @param id：图层id
 * @author 吴义迪
 * @create_time 2017-07-04
 */
function requestLegend(id){
	var legendType = null;
	// $("#tuli").text("图例");
	if(Config.loadLegend.indexOf(","+id+",") < 0 && $("#tree_ul_"+id+"").attr("levels") != null){
		if(Config.legendLayers.indexOf(","+id+",") > -1){
			initLegend(id);
		}
		if(Config.excludeLegendLayers.indexOf(","+id+",") < 0){
			addPoiLegend(id);
		}
	}else{
		// if(Config.layerType9.indexOf(","+id+",") >= 0){
		// 	legendType = Global.common.param1;
		// }
		if(Config.ajaxFalseLengendLayers.indexOf(","+id+",") >= 0){
			requestLegendByConditions(id, legendType, true);
		}else{
			requestLegendByConditions(id, legendType, false);
		}
	}
}

/**
 * @note 根据条件请求图例
 * @param id：图层id
 * @param legendType：切换类型时，改变图例
 * @param ajaxType：ajax请求async
 * @author 吴义迪
 * @create_time 2016-11-21
 */
function requestLegendByConditions(id, legendType, ajaxAsync){
	var data = {};
	data["layerId"] = id;
	if(legendType != null){
		data["legendType"] = legendType;
	}	
	$.ajax({
		url: "http://183.230.183.18:8088/AgriMonitor/tree/requestLegendByConditions.do",
		async: ajaxAsync, 
		type: "post",
		data: data,
		dataType: "json",
		//回调函数
		success:function(result){
			var status = result.status;
			var legend = result.data;
			//图例返回成功
			if(status == 1){
				$("#tree_ul_"+id).attr("value", legend.value);
				$("#tree_ul_"+id).attr("type", legend.type);
				$("#tree_ul_"+id).attr("levels", legend.levelsNum);
				$("#tree_ul_"+id).attr("text", legend.levels);
				$("#tree_ul_"+id).attr("colors", legend.colors);
				$("#tree_ul_"+id).attr("unit", legend.unit);
				if(Config.legendLayers.indexOf(","+id+",") > -1){
					initLegend(id);
				}
				if(Config.excludeLegendLayers.indexOf(","+id+",") < 0){
					// if( legend.unit == null || legend.unit == "null" || legend.unit == "-1" ){
					// }else {
					// 	$("#tuli").text("图例"+"("+ legend.unit +")");
					// }					
					addPoiLegend(id, legend);
				}
			}else{
				$("#tree_ul_"+id).attr("levels", "-1");
				//隐藏图例
				$("#legend-shadow").hide();
				$("#legend-line").hide();
				$(".legend-img").css("display", "none");
				$(".legend-show").css("display", "none");
				$(".legend-hid").css("display", "none");
			}
		},
		error:function(){
			//异常处理
			window.console.log("请求图例异常");
		}
	});
}

/**
 * @note 时间段查询
 * @author 吴义迪
 * @create_time 2017-07-02
 */
function SLTimeConfirmFunc(){
	var layers = Config.SLTimeLayers.split(",");
	for(var i=0; i<layers.length; i++){
		if($("#tree_li_"+layers[i]+"_img4").css("display") != "none" && $("#tree_li_"+layers[i]+"_img4").css("display") != null){
			loadLayer(layers[i]);
		}
	}
}

/**
 * @note 时间段时间轴关闭
 * @author 吴义迪
 * @create_time 2017-07-02
 */
function SLTimeExitFunc(){
	$(".time-check").hide();
	$("#beginTime_input").val("");
	$("#endTime_input").val("");
}

/**
 *  @note 请求农情调查
 *  @author 陈靖宇
 *  @create_time 2018-06-28
 */
function requestNPointLayer(id){
	var mycars=[ ];
	mycars = Config.layerTypeT;
	mycars = mycars.split(",");
	for ( j = 0; j < mycars.length; j++ ) {
	if ( Global.common.map.getLayersByName("layer_"+ mycars[j])[0] ) {
			Global.common.map.removeLayer( Global.common.map.getLayersByName("layer_"+ mycars[j])[0] );
			break;
		}
	}
	closePopup();
	var time = Global.common.time;
	var Nurl = "";
	if( id !== "all1" && id !=="58" ){
		Nurl += "AgrinfoController/getAgrinfos?cropid=" + id + "&dateTime=" + time;
	} else Nurl += "AgrinfoController/getAgrinfos?cropid=&dateTime=" + time;	
	$.ajax({
		url: Global.common.newUrl + Nurl +"&areaCode=50",
		type: "post",
		data: {},
		dataType: "json",
		//回调函数
		success:function(result){
			console.log(Nurl);
			Global.common.kjTitle = {"text": "农情调查分布图"};	
			if( result.data.length > 0){
				showNPointLayer(id, result.data);
			} else{
				document.querySelector("#farmdetail").innerHTML = "";
			}										
		},
		error:function(){
			window.console.log("请求基本点图数据异常");//异常处理
		}
	});
}

/**
 *  @note 请求涉农主体
 *  @author 陈靖宇
 *  @create_time 2018-07-24
 */
function requestAgriPointLayer(id){
	//关闭窗口
	closeCompany();
	var type = Global.common.param1.split(",")[1];
	Global.common.kjTitle = {"text": "涉农主体分布图"};	
	console.log(type);
	var code = localStorage.getItem("areaCode");
	$.ajax({
		url: Global.common.newUrl + "UserTypeController/getUserTypeList?areaCode="+ code +"&code=" + type,
		type: "post",
		data: {},
		dataType: "json",
		//回调函数
		success:function(result){	
			showAgriPointLayer(id, result.data);									
		},
		error:function(){
			//异常处理
			window.console.log("请求涉农主体数据异常");
		}
	});
}

/**
 *  @note 请求灾情调查
 *  @author 陈靖宇
 *  @create_time 2018-06-28
 */
function requestZPointLayer(id, time){
	var mycars=[ ];
	mycars = Config.layerTypeZ;
	mycars = mycars.split(",");
	for ( j = 0; j < mycars.length; j++ ) {
	if ( Global.common.map.getLayersByName("layer_"+ mycars[j])[0] ) {
			Global.common.map.removeLayer( Global.common.map.getLayersByName("layer_"+ mycars[j])[0] );
			break;
		}
	}
	closePopup();
	var Zurl = "";
	var time = Global.common.time;
	if( id == "all3" ){
		Zurl = "DisasterController/getDisasters?&areacode=50&dateTime=" + time;
	} else{
		Zurl = "DisasterController/getDisasters?&areacode=5&disasterType=" + id +"&dateTime=" + time;
	}
	$.ajax({
		url: Global.common.newUrl + Zurl,
		type: "post",
		data: {},
		dataType: "json",
		//回调函数
		success:function(result){
			console.log(Zurl);
			Global.common.kjTitle = {"text": "灾情调查分布图"};
			if( result.data.length > 0){
				showTPointLayer(id, result.data);
			}else{
				document.querySelector("#farmdetail").innerHTML = "";
			}						
		},
		error:function(){
			window.console.log("请求基本点图数据异常");//异常处理
		}
	});
}
/**
 *  @note 请求农田分布
 *  @author 陈靖宇
 *  @create_time 2018-07-05
 */
function requestFarmPointLayer(cropid){	
	var mycars=[ ];
	mycars = Config.layerTypeFarm;
	mycars = mycars.split(",");
	for ( j = 0; j < mycars.length; j++ ) {
	if ( Global.common.map.getLayersByName("layer_"+ mycars[j])[0] ) {
			Global.common.map.removeLayer( Global.common.map.getLayersByName("layer_"+ mycars[j])[0] );
			break;
		}
	}
	if( cropid == "all2" ){
		var Farmurl = "";
	} else var Farmurl = "&cropId=" + cropid;
	$.ajax({
		url: "http://39.107.24.230:8020/ChinaAPP/FarmlandController/getFramlandByCropIdAndAreaCode?areaCode=50"+ Farmurl,
		type: "post",
		data: {},
		dataType: "json",
		//回调函数
		success:function(result){
			Global.common.kjTitle = {"text": "农田分布图"};
			if( result.data.length > 0){
				showFarmPointLayer(cropid, result.data);
			}else{

			}	
		},
		error:function(){
			window.console.log("请求基本点图数据异常");//异常处理
		}
	});
}

/**
 * @note 请求基本点图数据
 * @author 吴义迪
 * @create_time 2017-07-02
 */
function requestBasePointLayer(id){
	var areacode = window.parent.storage["areacode"];
	if(areacode==undefined){
		areacode = "50";
	}else if(areacode=="500000"){
		areacode = "50";
	}
	//获取请求地址
	var monitorUrl = $("#tree_li_"+id+"").attr("layerUrl");
	//获取父节点
	var monitorFid = $("#tree_li_"+id+"").attr("fid");
	//判断执行哪种类型接口
	var ifTable = $("#tree_li_"+id+"").attr("ifTable");
	if(ifTable==2){
		$.post(Monitor.server.apiPath,{param:'{"Function":"monitor.'+monitorUrl+'","CustomParams":{limitFirst:0,limitSecond:10},"Type":2}'},function(data){			
			showBasePointLayer(id, data);
		});
	}else{
		var grade = $("#tree_li_"+id+"").attr("grade");
		if(monitorFid==105){
			$.post(Monitor.server.apiPath,{param:'{"Function":"'+monitorUrl+'","CustomParams":{areacode:"'+areacode+'",stationtype:"'+grade+'"},"Type":2}'},function(data){						
				showGuancePointLayer(id, data);								
			});
		}else{
			if(grade==1){
				$.post(Monitor.server.apiPath,{param:'{"Function":"monitor.'+monitorUrl+'","CustomParams":{areacode:"'+areacode+'"},"Type":2}'},function(data){
					//lert(data);	
					if( id == 260 ){
						showPointLayer1(id, data, "1");
					}else showBasePointLayer(id, data);
				});
			}else{
				$.post(Monitor.server.apiPath,{param:'{"Function":"monitor.'+monitorUrl+'","CustomParams":{areacode:"'+areacode+'",cropid:"'+grade+'"},"Type":2}'},function(data){
					//lert(data);
					showBasePointLayer(id, data);
				});
			}
		}	
	}
}

function openImageWin(url){
	CloseImageWin();
	$("#bigimage").attr('src', url);
	$("#datukuang").show();
}

function CloseImageWin(){
	$("#datukuang").hide();
}

/**
 * @note 请求基本点图数据 By url
 * @author 吴义迪
 * @create_time 2017-07-02
 */
function requestBasePointLayer1(id, url, showType){
	$.ajax({
		url: url,
		type: "post",
		data: {},
		dataType: "json",
		//回调函数
		success:function(result){
			if(result.status == 0){
				if(id == "110"){
					showPointLayer1(id, result.data, showType);
				}else{
					showBasePointLayer(id, result.data);
				}
			}
		},
		error:function(){
			//异常处理
			window.console.log("请求基本点图数据 By url异常");
		}
	});
}

/**
 * @note 展示农情点数据
 * @author 陈靖宇
 * @create_time 2018-06-28
 */
function showNPointLayer(id, value){
	if( value.length > 0){
	} else {
		$("#zhfw-zt-legend_div").hide();
	}
	Global.common.selectFeatureLayers = [];
	var layers = Global.common.map.getLayersByName("layer_"+id+"");
	if(layers.length > 0){
		layers[0].removeAllFeatures();
	}else{
		// layers.push(new SuperMap.Layer.Vector("layer_"+id+""));
		// Global.common.map.addLayer(layers[0]);
		// Global.common.selectFeatureLayers.push(layers[0]);
		clusterLayer = new SuperMap.Layer.ClusterLayer("layer_" + id, {
			clusterStyles:[ 
				{ 
					"count":15,//子节点小于等于15的聚散点 
					"style":{ 
						fontColor:"#404040", 
						graphic:true, 
						externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
						graphicWidth:37, 
						graphicHeight:38, 
						labelXOffset:-4, 
						labelYOffset:5 
					} 
				}, 
				{ 
					"count":50,//子节点小于等于50大于15的聚散点 
					"style":{ 
						fontColor:"#404040", 
						graphic:true, 
						externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
						graphicWidth:41, 
						graphicHeight:46, 
						labelXOffset:-3, 
						labelYOffset:6 
					} 
				}, 
				{ 
					"count":"moreThanMax",// 子节点大于50的聚散点 
					"style":{ 
						fontColor:"#404040", 
						graphic:true, 
						externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
						graphicWidth:48, 
						graphicHeight:53, 
						labelXOffset:-5, 
						labelYOffset:8 
					} 
				}]
		});
		Global.common.map.addLayers([clusterLayer]);
		Global.common.selectFeatureLayers.push(clusterLayer);
		Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
		refreshSelectCluster();
	}
	var fs = [];
	var citylist = [];
	var farmdetail= document.querySelector("#farmdetail"),	
		farmdetailhtml = "";
		farmdetail.innerHTML = farmdetailhtml;
	value.reverse();	   
	for(var i=0; i<value.length; i++){
		var lonStr = "longitude";
		var latStr = "latitude";
		if(Config[58] && Config[58].lon){
			lonStr = Config[58].lon;
		}
		if(Config[58] && Config[58].lat){
			latStr = Config[58].lat;
		}
		citylist.push(value[i].areaname);	
		var point = new SuperMap.Geometry.Point(value[i][lonStr],value[i][latStr]).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
    	var feature = new SuperMap.Feature.Vector(point);
    	feature.info = {};
		feature.info.layerId = id;
		feature.info.username = value[i].username;
		var time = new Date(parseInt(value[i].createtime))
		var year = ""+time.getFullYear(),
			month = time.getMonth()+1;
			if(month<10){
				month = "0"+month;
			}
			day = time.getDate();
			if(day<10){
				day = "0"+day;
			}
			hour = time.getHours();
			if(hour<10){
				hour = "0"+hour;
			}
			minues = time.getMinutes();
			if(minues<10){
				minues = "0"+minues;
			}	
		feature.info.time = year.substring(2)+"-"+month+"-"+day+" "+hour+":"+minues; 
		feature.info.descript = value[i].descript;
		feature.info.imgurl =JSON.parse(value[i].imgUrl);	
    	for(var k=0; k<Config[58].featurnInfo.length; k++){
    		feature.info[Config[58].featurnInfo[k].flag] = value[i][Config[58].featurnInfo[k].flag];
    	}
		//var colors = ["resources/images/u7162.png"]
		if( id == "all1" ){
			if( value[i].cropImgIcon == null ){
				feature.style = {	
					graphic: true,
					externalGraphic: "",
					graphicWidth: 0,//Config[58].featureImgStyle.graphicWidth,
					graphicHeight: 0,//Config[58].featureImgStyle.graphicWidth	
			   };
			} else {
				var imgUrl = "http://39.107.24.230:8020/ChinaAPP/"+ value[i].cropImgIcon;//colors[0];
				feature.style = {	
					graphic: true,
					externalGraphic: imgUrl,
					graphicWidth: 30,//Config[58].featureImgStyle.graphicWidth,
					graphicHeight: 30,//Config[58].featureImgStyle.graphicWidth	
			   };
			}			
		} else {
			var imgUrl = "http://39.107.24.230:8020/ChinaAPP/img/crop/"+ id + ".png";//colors[0];
			feature.style = {	
				graphic: true,
				externalGraphic: imgUrl,
				graphicWidth: 30,//Config[58].featureImgStyle.graphicWidth,
				graphicHeight: 30,//Config[58].featureImgStyle.graphicWidth	
		   };
		}	    
	    // if( i <= 4 ){
			if( i == 0 ){
				farmdetailhtml += "<hr style=\"margin: 6px 0; border-top:1px solid #fff;\"/>";
			}else {
				farmdetailhtml += "<hr style=\"margin: 6px 0; border-top:1px solid #ccc;\"/>";
			}
			farmdetailhtml += "	<li style=\"cursor: pointer;display:flex\" onclick=\"findFeature('"+ i +"')\">" +
						 "		<span style='flex:4'>	<div title=\""+feature.info.time+"\">"+feature.info.time+"</div>" +
						 "			<div title=\""+feature.info.descript+"\">"+feature.info.descript+"</div></span><span style='flex:1'>"
						if( feature.info.imgurl != null && feature.info.imgurl != "" && feature.info.imgurl != "no pic"){							
							url = "http://39.107.24.230:8020/ChinaAPP/"+feature.info.imgurl[0];
							farmdetailhtml += "<img style=\"width: 50px; height: 50px;\" onclick=\"openImageWin('"+ url +"')\" src=\"http://39.107.24.230:8020/ChinaAPP/"+feature.info.imgurl[0]+"\"/>"
						} else {
							farmdetailhtml += "<img style=\"width: 50px; height: 50px; float: right;\" src=\"resources/images/noimage.png\"/>"
						}			
						farmdetailhtml += " </span></li>"; 
		// }	
	    fs.push(feature);
	}
	// Global.common.farmnum = [];
	// Global.common.farmnum = tongji(citylist);
	// console.log(Global.common.farmnum);
	// if( value.length > 0){
	// 	addFenbuLegend(id);
	// }
	farmdetail.innerHTML = farmdetailhtml;
	clusterLayer.addFeatures(fs);	
	//layers[0].addFeatures(fs);
}
/**
 * @ 定位点位置
 * @anthor 陈靖宇
 * @create_time 2018-07-13
 */
function findFeature(num){
	//关闭大图框
	CloseImageWin();
	//num = page*3 + index;
	var f = Global.common.selectFeatureLayers[0].clusterPoints[num];
	//Global.common.map.centerAndZoom(new LngLat(point.x, point.y), 8);
	Global.common.map.setCenter(new SuperMap.LonLat(f.geometry.x, f.geometry.y), 8);
	closePopup();
	if(f.info){
		//测距删除
		if(f.info.layerId && f.info.layerId == Global.measure.lengthLayerX.id){
			removeMeasureFeature(f);
		}else if(f.info.layerId && Config.linkLayers.indexOf(","+f.info.layerId+",") >= 0){
			window.top.open(f.info[Config[f.info.layerId].linkUrl]);
		}else if(f.info.layerId && "yjxh" == f.info.layerId){
			openYJXHPopup(f);
		}else if(f.info.layerId && Config.layerTypeT.indexOf(","+f.info.layerId+",") >= 0 || Config.layerTypeZ.indexOf(","+f.info.layerId+",") >= 0){
			openNPointLayerPopup(f);
		}else if(f.info.layerId && Config.layerTypeFarm.indexOf(","+f.info.layerId+",") >= 0){
			openNPointLayerPopup(f);
		}else if(f.info.layerId && Config.station.indexOf(","+f.info.layerId+",") >= 0){
			openBasePointLayerPopup(f);
		}
	}
}

/**
 * @note 展示农田数据
 * @author 陈靖宇
 * @create_time 2018-07-05
 */
function showFarmPointLayer(id, value){
	if( value.length > 0){
	} else {
		$("#zhfw-zt-legend_div").hide();
	}
	Global.common.selectFeatureLayers = [];
	var layers = Global.common.map.getLayersByName("layer_"+id+"");
	if(layers.length > 0){
		layers[0].removeAllFeatures();
	}else{
		clusterLayer = new SuperMap.Layer.ClusterLayer("layer_" + id, {
			clusterStyles:[ 
				{ 
					"count":15,//子节点小于等于15的聚散点 
					"style":{ 
						fontColor:"#404040", 
						graphic:true, 
						externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
						graphicWidth:37, 
						graphicHeight:38, 
						labelXOffset:-4, 
						labelYOffset:5 
					} 
				}, 
				{ 
					"count":50,//子节点小于等于50大于15的聚散点 
					"style":{ 
						fontColor:"#404040", 
						graphic:true, 
						externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
						graphicWidth:41, 
						graphicHeight:46, 
						labelXOffset:-3, 
						labelYOffset:6 
					} 
				}, 
				{ 
					"count":"moreThanMax",// 子节点大于50的聚散点 
					"style":{ 
						fontColor:"#404040", 
						graphic:true, 
						externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
						graphicWidth:48, 
						graphicHeight:53, 
						labelXOffset:-5, 
						labelYOffset:8 
					} 
				}]
		});
		Global.common.map.addLayers([clusterLayer]);
		Global.common.selectFeatureLayers.push(clusterLayer);
		Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
		refreshSelectCluster();
	}
	var fs = [];
	var citylist = [];
	for(var i=0; i<value.length; i++){
		var lonStr = "longitude";
		var latStr = "latitude";
		if(Config[104] && Config[104].lon){
			lonStr = Config[104].lon;
		}
		if(Config[104] && Config[104].lat){
			latStr = Config[104].lat;
		}
		citylist.push(value[i].areaname);	
		var point = new SuperMap.Geometry.Point(value[i][lonStr],value[i][latStr]).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
    	var feature = new SuperMap.Feature.Vector(point);
    	feature.info = {};
		feature.info.layerId = id;
		feature.info.username = value[i].username;
		var time = new Date(parseInt(value[i].createtime))
		var year = ""+time.getFullYear(),
			month = time.getMonth()+1;
			if(month<10){
				month = "0"+month;
			}
			day = time.getDate();
			if(day<10){
				day = "0"+day;
			}
			hour = time.getHours();
			if(hour<10){
				hour = "0"+hour;
			}
			minues = time.getMinutes();
			if(minues<10){
				minues = "0"+minues;
			}
		feature.info.time = year.substring(2)+"-"+month+"-"+day+" "+hour+":"+minues; 
		feature.info.descript = value[i].descript;
		// feature.info.imgurl =JSON.parse(value[i].imgUrl);
    	for(var k=0; k<Config[104].featurnInfo.length; k++){
    		feature.info[Config[104].featurnInfo[k].flag] = value[i][Config[104].featurnInfo[k].flag];
    	}
		var imgUrl = "http://39.107.24.230:8020/ChinaAPP/img/farmland/icon/farmland.png";
		feature.style = {	
				graphic: true,
				externalGraphic: imgUrl,
				graphicWidth: 30,//Config[58].featureImgStyle.graphicWidth,
				graphicHeight: 30,//Config[58].featureImgStyle.graphicWidth	
		};		 	    
	    fs.push(feature);
	}
	// Global.common.farmnum = [];
	// Global.common.farmnum = tongji(citylist);
	// console.log(Global.common.farmnum);
	// if( value.length > 0){
	// 	addFenbuLegend(id);
	// }	
	// layers[0].addFeatures(fs);
	// if(Config[104].selectCluster){
	// 	Config[104].selectCluster.deactivate();
	// }
	// Global.common.map.removeControl(Config[104].selectCluster);
	// Config[104].selectCluster = null;
	clusterLayer.addFeatures(fs);	
}

/**
 * @note 展示灾情点数据
 * @author 陈靖宇
 * @create_time 2018-06-28
 */
function showTPointLayer(id, value){
	if( value.length > 0){
	} else {
		$("#zhfw-zt-legend_div").hide();
	}	
	Global.common.selectFeatureLayers = [];
	var layers = Global.common.map.getLayersByName("layer_"+id+"");
	if(layers.length > 0){
		layers[0].removeAllFeatures();
	}else{
		clusterLayer = new SuperMap.Layer.ClusterLayer("layer_" + id, {
			clusterStyles:[ 
				{ 
					"count":15,//子节点小于等于15的聚散点 
					"style":{ 
						fontColor:"#404040", 
						graphic:true, 
						externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
						graphicWidth:37, 
						graphicHeight:38, 
						labelXOffset:-4, 
						labelYOffset:5 
					} 
				}, 
				{ 
					"count":50,//子节点小于等于50大于15的聚散点 
					"style":{ 
						fontColor:"#404040", 
						graphic:true, 
						externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
						graphicWidth:41, 
						graphicHeight:46, 
						labelXOffset:-3, 
						labelYOffset:6 
					} 
				}, 
				{ 
					"count":"moreThanMax",// 子节点大于50的聚散点 
					"style":{ 
						fontColor:"#404040", 
						graphic:true, 
						externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
						graphicWidth:48, 
						graphicHeight:53, 
						labelXOffset:-5, 
						labelYOffset:8 
					} 
				}]
		});
		Global.common.map.addLayers([clusterLayer]);
		Global.common.selectFeatureLayers.push(clusterLayer);
		Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
		refreshSelectCluster();
	}
	var fs = [];
	var citylist = [];
	var disastertail= document.querySelector("#farmdetail"),	
		disastertailhtml = "";
		disastertail.innerHTML = disastertailhtml;
	value.reverse();	
	for(var i=0; i<value.length; i++){
		var lonStr = "longitude";
		var latStr = "latitude";
		if(Config[233] && Config[233].lon){
			lonStr = Config[233].lon;
		}
		if(Config[233] && Config[233].lat){
			latStr = Config[233].lat;
		}
		citylist.push(value[i].areaname);		
		var point = new SuperMap.Geometry.Point(value[i][lonStr]/1000000,value[i][latStr]/1000000).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
    	var feature = new SuperMap.Feature.Vector(point);
    	feature.info = {};
		feature.info.layerId = id;
		feature.info.username = value[i].username;
		var time = new Date(parseInt(value[i].createtime))
		var year = ""+time.getFullYear(),
			month = time.getMonth()+1;
			if(month<10){
				month = "0"+month;
			}
			day = time.getDate();
			if(day<10){
				day = "0"+day;
			}
			hour = time.getHours();
			if(hour<10){
				hour = "0"+hour;
			}
			minues = time.getMinutes();
			if(minues<10){
				minues = "0"+minues;
			}
		feature.info.time = year.substring(2)+"-"+month+"-"+day+" "+hour+":"+minues; 
		feature.info.descript = value[i].descript;
		feature.info.imgurl =JSON.parse(value[i].imgUrl);
    	for(var k=0; k<Config[233].featurnInfo.length; k++){
    		feature.info[Config[233].featurnInfo[k].flag] = value[i][Config[233].featurnInfo[k].flag];
    	}
	    //var colors = ["resources/images/u7162.png"]
	    var imgUrl = "http://39.107.24.230:8020/ChinaAPP/img/disaster/icon/"+ value[i].disastertype +".png";//colors[0];
	    feature.style = {	
				graphic: true,
				externalGraphic: imgUrl,
				graphicWidth: 30,
				graphicHeight: 30,
		};
		if( i <= 2 ){
			if( i == 0 ){
				disastertailhtml += "<hr style=\"margin: 6px 0; border-top:1px solid #fff;\"/>";
			}else {
				disastertailhtml += "<hr style=\"margin: 6px 0; border-top:1px solid #ccc;\"/>";
			}
			disastertailhtml += "	<li style=\"cursor: pointer;display:flex\" onclick=\"findFeature('"+ i +"')\">" +
						 "		<span style='flex:4'>	<div title=\""+feature.info.time+"\">"+feature.info.time+"</div>" +
						 "			<div title=\""+feature.info.descript+"\">"+feature.info.descript+"</div></span><span style='flex:1'>"
						if( feature.info.imgurl != null && feature.info.imgurl != "" && feature.info.imgurl != "no pic"){
							url = "http://39.107.24.230:8020/ChinaAPP/"+feature.info.imgurl[0];
							disastertailhtml += "<img style=\"width: 50px; height: 50px;\" onclick=\"openImageWin('"+ url +"')\" src=\"http://39.107.24.230:8020/ChinaAPP/"+feature.info.imgurl[0]+"\"/>"
						} else {
							disastertailhtml += "<img style=\"width: 50px; height: 50px; float: right;\" src=\"resources/images/noimage.png\"/>"
						}			
						disastertailhtml += " </span></li>"; 
		}	
	    fs.push(feature);
	}
	// Global.common.farmnum = [];
	// Global.common.farmnum = tongji(citylist);
	// console.log(Global.common.farmnum);
	// if( value.length > 0){
	// 	addFenbuLegend(id);
	// }	
	// layers[0].addFeatures(fs);
	disastertail.innerHTML = disastertailhtml;
	clusterLayer.addFeatures(fs);	
}
/**
 *  @note 统计 灾情/农情分布情况
 *  @author 陈靖宇
 *  @create_time 2018/07/03
 */
// function tongji(arr){
// 	var newArr = [];
// 	for(var i=0;i<arr.length;i++){
// 		var temp=arr[i];
// 		var count=0;
// 		for(var j=0;j<arr.length;j++){
// 			if(arr[j]==temp){
// 				count++;
// 				arr[j]=-1;
// 			}
// 		}
// 		if(temp != -1){
// 			newArr.push(temp+": "+count)
// 		}
// 	}
// 	return newArr;
// }

/**
 * @note 展示基本点图数据
 * @author 吴义迪
 * @create_time 2017-07-02
 */
function showBasePointLayer(id, value){
	var layers = Global.common.map.getLayersByName("layer_"+id+"");
	if(layers.length > 0){
		layers[0].removeAllFeatures();
	}else{
		if( id == 103){
			clusterLayer = new SuperMap.Layer.ClusterLayer("layer_" + id, {
				clusterStyles:[ 
					{ 
						"count":15,//子节点小于等于15的聚散点 
						"style":{ 
							fontColor:"#404040", 
							graphic:true, 
							externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
							graphicWidth:37, 
							graphicHeight:38, 
							labelXOffset:-4, 
							labelYOffset:5 
						} 
					}, 
					{ 
						"count":50,//子节点小于等于50大于15的聚散点 
						"style":{ 
							fontColor:"#404040", 
							graphic:true, 
							externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
							graphicWidth:41, 
							graphicHeight:46, 
							labelXOffset:-3, 
							labelYOffset:6 
						} 
					}, 
					{ 
						"count":"moreThanMax",// 子节点大于50的聚散点 
						"style":{ 
							fontColor:"#404040", 
							graphic:true, 
							externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
							graphicWidth:48, 
							graphicHeight:53, 
							labelXOffset:-5, 
							labelYOffset:8 
						} 
					}]
			});
			Global.common.map.addLayers([clusterLayer]);
			Global.common.selectFeatureLayers.push(clusterLayer);
		} else{
			layers.push(new SuperMap.Layer.Vector("layer_"+id+""));
			Global.common.map.addLayer(layers[0]);
			Global.common.selectFeatureLayers.push(layers[0]);
		}		
		Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
		refreshSelectCluster();
	}
	var fs = [];
	for(var i=0; i<value.length; i++){
		var lonStr = "longitude";
		var latStr = "latitude";
		if(Config[id] && Config[id].lon){
			lonStr = Config[id].lon;
		}
		if(Config[id] && Config[id].lat){
			latStr = Config[id].lat;
		}
		var point = new SuperMap.Geometry.Point(value[i][lonStr],value[i][latStr]).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
    	var feature = new SuperMap.Feature.Vector(point);
    	feature.info = {};
    	feature.info.layerId = id;
    	for(var k=0; k<Config[id].featurnInfo.length; k++){
    		feature.info[Config[id].featurnInfo[k].flag] = value[i][Config[id].featurnInfo[k].flag];
    	}
    	var levels = $("#tree_ul_"+id).attr("levels").split(",");
		var colors = $("#tree_ul_"+id).attr("colors").split(";");
		//罗列
		if($("#tree_ul_"+id).attr("value") == "1"){
			//图片类型
			if($("#tree_ul_"+id).attr("type") == "2"){
	    		var imgUrl = "";
	    		if(levels.length == 1 && levels[0] == "-1"){
	    			imgUrl = colors[0];
	    		}else{
	    			
	    		}
	    		feature.style = {	
					graphic: true,
					externalGraphic: imgUrl,
					graphicWidth: Config[id].featureImgStyle.graphicWidth,
					graphicHeight: Config[id].featureImgStyle.graphicWidth	
				};
	    	}
			//点类型
			else if($("#tree_ul_"+id).attr("type") == "1" || $("#tree_ul_"+id).attr("type") == "3"){
				var fillColor = "";
	    		if(levels.length == 1 && levels[0] == "-1"){
	    			fillColor = colors[0];
	    		}else{
	    			
	    		}
				feature.style = {
					fillColor: fillColor,
			      	strokeColor: Config[id].featureStyle.strokeColor,
			      	strokeWidth: Config[id].featureStyle.strokeWidth,
			      	strokeOpacity: Config[id].featureStyle.strokeOpacity,
			      	pointRadius: Config[id].featureStyle.pointRadius,
			      	fillOpacity: Config[id].featureStyle.fillOpacity
		    	};
			}
		}
	    fs.push(feature);
	}
	if( id == "103"){
		//将数据添加到图层中
		clusterLayer.addFeatures(fs);
	} else layers[0].addFeatures(fs);
}

/**
 * @note 展示涉农主体的分布
 * @author 陈靖宇
 * @create_time 2017-07-24
 */
function showAgriPointLayer(id, value){
	var layers = Global.common.map.getLayersByName("layer_"+id+"");
	if(layers.length > 0){
		layers[0].removeAllFeatures();
	}else{
		clusterLayer = new SuperMap.Layer.ClusterLayer("layer_" + id, {
		clusterStyles:[ 
					{ 
						"count":15,//子节点小于等于15的聚散点 
						"style":{ 
							fontColor:"#404040", 
							graphic:true, 
							externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
							graphicWidth:37, 
							graphicHeight:38, 
							labelXOffset:-4, 
							labelYOffset:5 
						} 
					}, 
					{ 
						"count":50,//子节点小于等于50大于15的聚散点 
						"style":{ 
							fontColor:"#404040", 
							graphic:true, 
							externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
							graphicWidth:41, 
							graphicHeight:46, 
							labelXOffset:-3, 
							labelYOffset:6 
						} 
					}, 
					{ 
						"count":"moreThanMax",// 子节点大于50的聚散点 
						"style":{ 
							fontColor:"#404040", 
							graphic:true, 
							externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
							graphicWidth:48, 
							graphicHeight:53, 
							labelXOffset:-5, 
							labelYOffset:8 
						} 
					}]
		});
		Global.common.map.addLayers([clusterLayer]);
		Global.common.selectFeatureLayers.push(clusterLayer);	
		Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
		refreshSelectCluster();
	}
	var fs = [];
	for(var i=0; i<value.length; i++){
		var lonStr = "longitude";
		var latStr = "latitude";
		if(Config[id] && Config[id].lon){
			lonStr = Config[id].lon;
		}
		if(Config[id] && Config[id].lat){
			latStr = Config[id].lat;
		}
		var point = new SuperMap.Geometry.Point(value[i].longitude/1000000,value[i].latitude/1000000).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
    	var feature = new SuperMap.Feature.Vector(point);
    	feature.info = {};
		feature.info.layerId = id;
		feature.info.userid = value[i].id;
    	for(var k=0; k<Config[id].featurnInfo.length; k++){
    		feature.info[Config[id].featurnInfo[k].flag] = value[i][Config[id].featurnInfo[k].flag];
    	}
    	var imgurl = "resources/images/" + value[i].code + ".png";
	    feature.style = {	
			graphic: true,
			externalGraphic: imgurl,
			graphicWidth: 20,
			graphicHeight: 20	
		};
	    fs.push(feature);
	}
	//将数据添加到图层中
	clusterLayer.addFeatures(fs);
}

/**
 * @note 展示观测站点数据
 * @author 李峰
 * @create_time 2018-04-17
 *  Address:null
	Alti:83
	Cnty:"酉阳县"
	Lat:28.82
	Lon:108.77
	Station_Id:"57633"
	Station_Name:"酉阳"
	Station_level:"11"
	areacode:"500242"
 */
function showGuancePointLayer(id, value){
	var layers = Global.common.map.getLayersByName("layer_"+id+"");
	if(layers.length > 0){
		layers[0].removeAllFeatures();
	}else{		
		if(id == 242 || id == 243 ){
			clusterLayer = new SuperMap.Layer.ClusterLayer("layer_" + id, {
				clusterStyles:[ 
					{ 
						"count":15,//子节点小于等于15的聚散点 
						"style":{ 
							fontColor:"#404040", 
							graphic:true, 
							externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
							graphicWidth:37, 
							graphicHeight:38, 
							labelXOffset:-4, 
							labelYOffset:5 
						} 
					}, 
					{ 
						"count":50,//子节点小于等于50大于15的聚散点 
						"style":{ 
							fontColor:"#404040", 
							graphic:true, 
							externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
							graphicWidth:41, 
							graphicHeight:46, 
							labelXOffset:-3, 
							labelYOffset:6 
						} 
					}, 
					{ 
						"count":"moreThanMax",// 子节点大于50的聚散点 
						"style":{ 
							fontColor:"#404040", 
							graphic:true, 
							externalGraphic:SuperMap.Util.getImagesLocation()+"cluster3.png", 
							graphicWidth:48, 
							graphicHeight:53, 
							labelXOffset:-5, 
							labelYOffset:8 
						} 
					}]
			});
			Global.common.map.addLayers([clusterLayer]);
			Global.common.selectFeatureLayers.push(clusterLayer);
		}else {
			layers.push(new SuperMap.Layer.Vector("layer_"+id+""));
			Global.common.map.addLayer(layers[0]);
			Global.common.selectFeatureLayers.push(layers[0]);
		}		
		Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
		refreshSelectCluster();
	}
	var fs = [];
	for(var i=0; i<value.length; i++){
		var lonStr = "Lon";
		var latStr = "Lat";
		if(Config[id] && Config[id].lon){
			lonStr = Config[id].lon;
		}
		if(Config[id] && Config[id].lat){
			latStr = Config[id].lat;
		}
		var point = new SuperMap.Geometry.Point(value[i][lonStr],value[i][latStr]).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
    	var feature = new SuperMap.Feature.Vector(point);
    	feature.info = {};
    	feature.info.layerId = id;
    	for(var k=0; k<Config[id].featurnInfo.length; k++){
    		feature.info[Config[id].featurnInfo[k].flag] = value[i][Config[id].featurnInfo[k].flag];
    	}
    	var levels = $("#tree_ul_"+id).attr("levels").split(",");
		var colors = $("#tree_ul_"+id).attr("colors").split(";");
		//罗列
		if($("#tree_ul_"+id).attr("value") == "1"){
			//图片类型
			if($("#tree_ul_"+id).attr("type") == "2"){
	    		var imgUrl = "";
	    		if(levels.length == 1 && levels[0] == "-1"){
	    			imgUrl = colors[0];
	    		}else{
	    			
	    		}
	    		feature.style = {	
					graphic: true,
					externalGraphic: imgUrl,
					graphicWidth: Config[id].featureImgStyle.graphicWidth,
					graphicHeight: Config[id].featureImgStyle.graphicWidth	
				};
	    	}
			//点类型
			else if($("#tree_ul_"+id).attr("type") == "1" || $("#tree_ul_"+id).attr("type") == "3"){
				var fillColor = "";
	    		if(levels.length == 1 && levels[0] == "-1"){
	    			fillColor = colors[0];
	    		}else{
	    			
	    		}
				feature.style = {
					fillColor: fillColor,
			      	strokeColor: Config[id].featureStyle.strokeColor,
			      	strokeWidth: Config[id].featureStyle.strokeWidth,
			      	strokeOpacity: Config[id].featureStyle.strokeOpacity,
			      	pointRadius: Config[id].featureStyle.pointRadius,
			      	fillOpacity: Config[id].featureStyle.fillOpacity
		    	};
			}
		}
	    fs.push(feature);
	}
	if( id == "242" || id == "243"){			
	 	//将数据添加到图层中
		clusterLayer.addFeatures(fs);
	} else{	
		layers[0].addFeatures(fs);
	}
}

/**
 * @note 展示点图数据-1
 * @author 吴义迪
 * @create_time 2017-09-01
 */
function showPointLayer1(id, value, showType){
	var layers = Global.common.map.getLayersByName("layer_"+id+"");
	var flag = true;
	if(layers.length > 0){
		for(var b=0; b<layers.length; b++){
			if(layers[b].features){
				layers[b].removeAllFeatures();
				flag = false;
			}
		}
	}
	if(flag == true){
		layers.push(new SuperMap.Layer.Vector("layer_"+id+""));
		Global.common.map.addLayer(layers[layers.length-1]);
		Global.common.selectFeatureLayers.push(layers[layers.length-1]);
		Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
		refreshSelectCluster();
	}
	var fs = [];
	for(var i=0; i<value.length; i++){
		var lonStr = "lon";
		var latStr = "lat";
		if(Config[id] && Config[id].lon){
			lonStr = Config[id].lon;
		}
		if(Config[id] && Config[id].lat){
			latStr = Config[id].lat;
		}
		var point = new SuperMap.Geometry.Point(value[i][lonStr],value[i][latStr]).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
    	var feature = new SuperMap.Feature.Vector(point);
    	feature.info = {};
    	feature.info.layerId = id;
    	for(var k=0; k<Config[id].featurnInfo.length; k++){
    		feature.info[Config[id].featurnInfo[k].flag] = value[i][Config[id].featurnInfo[k].flag];
    	}
    	var levels = ["-1"];
		var colors = ["#ff0000"];
		//图片类型
		if(showType == "2"){
    		var imgUrl = "";
    		if(levels.length == 1 && levels[0] == "-1"){
    			imgUrl = colors[0];
    		}else{
    			
    		}
    		feature.style = {	
				graphic: true,
				externalGraphic: imgUrl,
				graphicWidth: Config[id].featureImgStyle.graphicWidth,
				graphicHeight: Config[id].featureImgStyle.graphicWidth	
			};
    	}
		//点类型
		else if(showType == "1" || showType == "3"){
			var fillColor = "";
    		if(levels.length == 1 && levels[0] == "-1"){
    			fillColor = colors[0];
    		}else{
    			
    		}
			feature.style = {
				fillColor: fillColor,
		      	strokeColor: Config[id].featureStyle.strokeColor,
		      	strokeWidth: Config[id].featureStyle.strokeWidth,
		      	strokeOpacity: Config[id].featureStyle.strokeOpacity,
		      	pointRadius: Config[id].featureStyle.pointRadius,
		      	fillOpacity: Config[id].featureStyle.fillOpacity
	    	};
		}
	    fs.push(feature);
	}
	for(var a=0; a<layers.length; a++){
		if(layers[a].features){
			layers[a].addFeatures(fs);
			break;
		}
	}
}

/**
 * @note 请求铁路数据
 * @author 吴义迪
 * @create_time 2017-07-03
 */
function requestRailwayInfo(id){
	$.ajax({
		url: "http://127.0.0.1:8088/baseframeworkweb" + $("#tree_li_"+id+"").attr("layerUrl"),
		type: "post",
		data: {},
		dataType: "json",
		//回调函数
		success:function(result){
			if(result.status == 0){
				var value = result.data;
				var railway = [];
				var regionStr = "";
				for(var i=0; i<value.length; i++){
					if(regionStr.indexOf(value[i].region) >= 0){
						for(var j=0; j<railway.length; j++){
							if(value[i].region == railway[j].region){
								railway[j].stations.push(value[i]);
								break;
							}
						}
					}else{
						regionStr += value[i].region + ",";
						var obj = {"region":value[i].region, "stations":[]};
						obj.stations.push(value[i]);
						railway.push(obj);
					}
				}
				//绘制铁路线路图层
				showRailwayLayer(id, railway);
			}
		},
		error:function(){
			//异常处理
			window.console.log("请求铁路数据异常");
		}
	});
}

/**
 * @note 绘制铁路线路图层
 * @author 吴义迪
 * @create_time 2017-07-03
 */
function showRailwayLayer(id, railway){
	var layers = Global.common.map.getLayersByName("layer_"+id+"");
	if(layers.length > 0){
		layers[0].removeAllFeatures();
	}else{
		layers.push(new SuperMap.Layer.Vector("layer_"+id+""));
		Global.common.map.addLayer(layers[0]);
		Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
		refreshSelectCluster();
	}
	var fs = [];
	for(var i=0; i<railway.length; i++){
		var points = [];
		for(var j=0; j<railway[i].stations.length; j++){
			var p = new SuperMap.Geometry.Point(railway[i].stations[j].lon,railway[i].stations[j].lat).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
			points.push(p);
		}
		var line = new SuperMap.Geometry.LineString(points);
		var feature = new SuperMap.Feature.Vector(line);
		feature.style = {
	        strokeColor:"#333",
	        strokeWidth:3
	    };
		fs.push(feature);
	}
	layers[0].addFeatures(fs);
}

/**
 * @note 请求聚散图层
 * @author 吴义迪
 * @create_time 2017-07-03
 */
function requestClusterLayer(id){
	var data = {};
	if(Config[id].ajaxData){
		data = Config[id].ajaxData;
	}
	$.ajax({
		url: "http://127.0.0.1:8088/baseframeworkweb" + $("#tree_li_"+id+"").attr("layerUrl"),
		type: "post",
		data: data,
		dataType: "json",
		//回调函数
		success:function(result){
			if(result.status == 0){
				var value;
				if(typeof result.data != "object"){
					var obj = JSON.parse(result.data);
					value = obj.DS;
				}else{
					value = result.data;
				}
				showClusterLayer(id, value);
			}
		},
		error:function(){
			//异常处理
			window.console.log("请求聚散图数据异常");
		}
	});
}

/**
 * @note 展示聚散图层
 * @author 吴义迪
 * @create_time 2017-07-11
 */
function showClusterLayer(id, value){
	var layers = Global.common.map.getLayersByName("layer_"+id+"");
	if(layers.length > 0){
		layers[0].removeAllFeatures();
	}else{
		var labelYOffset = 0;
		if($(window).width > 1900){
			labelYOffset = -4;
		}
		layers.push(new SuperMap.Layer.ClusterLayer("layer_"+id+"", {
			clusterStyles:[
			{ 
				"count":9,//子节点小于等于xx1的聚散点 
				"style":{ 
					fontColor:"#fff", 
					fontSize: "13px",
					strokeWidth: 0,
					fillColor: $("#tree_ul_"+id).attr("colors").split(";")[0],
					pointRadius: 12,
                   	fillOpacity: 0.8,
                   	labelXOffset: 0, 
                   	labelYOffset: labelYOffset
               } 
			},
			{ 
				"count":99,//子节点小于等于xx1的聚散点 
				"style":{ 
					fontColor:"#fff", 
					fontSize: "13px",
					strokeWidth: 0,
					fillColor: $("#tree_ul_"+id).attr("colors").split(";")[0],
					pointRadius: 15,
					fillOpacity: 0.8,
                   	labelXOffset: 0, 
                   	labelYOffset: labelYOffset
               } 
			},
			{ 
				"count":999,//子节点小于等于xx2大于xx1的聚散点 
				"style":{ 
					fontColor:"#fff", 
					fontSize: "13px",
                  	graphic:true, 
                  	strokeWidth: 0,
					fillColor: $("#tree_ul_"+id).attr("colors").split(";")[0],
					pointRadius: 18,
					fillOpacity: 0.8,
                  	labelXOffset: 0, 
                  	labelYOffset: labelYOffset
               } 
           }, 
           { 
               	"count":"moreThanMax",// 子节点大于xx2的聚散点 
               	"style":{ 
                  	fontColor:"#fff", 
                  	fontSize: "13px",
                  	graphic:true, 
                  	strokeWidth: 0,
					fillColor: $("#tree_ul_"+id).attr("colors").split(";")[0],
					pointRadius: 20,
					fillOpacity: 0.8,
                  	labelXOffset: 0, 
                  	labelYOffset: labelYOffset
               	} 
           } 
           ],
           maxLevel: Config[id].maxLevel,
           maxDiffuseAmount: Config[id].maxDiffuseAmount
		}));
		Global.common.map.addLayer(layers[0]);
		Global.common.selectFeatureLayers.push(layers[0]);
		Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
		Config[id].selectCluster = new SuperMap.Control.SelectCluster(layers[0], { 
		    callbacks:{ 
		    	//点击事件 
		    	click:function(f){
		    		
		        }, 
		        //鼠标移入
		        over:function(f){ 
		        	//聚散点 
		    		if(f.isCluster){ 
		    			var param = {
		    				count: f.children.length,
		    				title: Config[id].popupTitle
		    			};
		    			openClusterPopup(f, param);
		            } 
		    		//非聚散点 
		            else{ 
		            	openBasePointLayerPopup(f);
		            } 
		        }, 
		        //鼠标移出
		        out:function(f){
		            closePopup();
		        }, 
		        //双击事件 
		        dblclick:function(f){ 
		             
		        } 
		    } 
		});
		//将控件添加到地图上
		Global.common.map.addControl(Config[id].selectCluster);
	    //激活控件。
		Config[id].selectCluster.activate();
	}
	var fs = [];
	for(var i=0; i<value.length; i++){
		var lonStr = "lon";
		var latStr = "lat";
		if(Config[id] && Config[id].lon){
			lonStr = Config[id].lon;
		}
		if(Config[id] && Config[id].lat){
			latStr = Config[id].lat;
		}
		//判断经纬度是否正确
		// if(checkoutGeometryPoint(value[i][lonStr],value[i][latStr]) == false){
		// 	continue;
		// }
		var point = new SuperMap.Geometry.Point(value[i][lonStr],value[i][latStr]).transform("EPSG:"+Global.transform.source+"","EPSG:"+Global.transform.dest+"");
    	var feature = new SuperMap.Feature.Vector(point);
		var levels = $("#tree_ul_"+id).attr("levels").split(",");
		var colors = $("#tree_ul_"+id).attr("colors").split(";");
    	if($("#tree_ul_"+id).attr("type") == "5"){
    		var imgUrl = "";
    		if(levels.length == 1 && levels[0] == "-1"){
    			imgUrl = colors[1];
    		}else{
    			for(var k=0; k<levels.length; k++){
	    			if(value[i][Config[id].legendColumn] == levels[k]){
			    		imgUrl = colors[k+1];
			    		break;
			    	}
	    		}
    		}
	    	feature.style = {	
				graphic: true,
				externalGraphic: imgUrl,
				graphicWidth: Config[id].featureImgStyle.graphicWidth,
				graphicHeight: Config[id].featureImgStyle.graphicWidth	
			};
    	}else if($("#tree_ul_"+id).attr("type") == "6"){
    		var fillColor = "";
    		if(levels.length == 1 && levels[0] == "-1"){
    			fillColor = colors[1];
    		}else{
    			for(var k=0; k<levels.length; k++){
	    			if(value[i][Config[id].legendColumn] == levels[k]){
	    				fillColor = colors[k+1];
			    		break;
			    	}
	    		}
    		}
    		feature.style = {
				fillColor: fillColor,
		      	strokeColor: Config[id].featureStyle.strokeColor,
		      	strokeWidth: Config[id].featureStyle.strokeWidth,
		      	strokeOpacity: Config[id].featureStyle.strokeOpacity,
		      	pointRadius: Config[id].featureStyle.pointRadius,
		      	fillOpacity: Config[id].opacity
	    	};
    	}
    	feature.info = {};
    	feature.info.layerId = id;
    	for(var k=0; k<Config[id].featurnInfo.length; k++){
    		//处理时间
    		if(Config[id].featurnInfo[k].date == true){
    			var date = new Date();
    			date.setTime(value[i][Config[id].featurnInfo[k].flag]);
    			feature.info[Config[id].featurnInfo[k].flag] = timeFormat1(date);
    		}else{
    			feature.info[Config[id].featurnInfo[k].flag] = value[i][Config[id].featurnInfo[k].flag];
    		}
    	}
	    fs.push(feature);
	}
	layers[0].addFeatures(fs);
}

/**
 * @note 刷新聚散控件
 * @author 吴义迪
 * @create_time 2017-07-03
 */
function refreshSelectCluster(){
	var array = Config.layerType5.split(",");
	for(var i=0; i<array.length; i++){
		if(Config[array[i]] != null && Config[array[i]].selectCluster != null){
			Config[array[i]].selectCluster.deactivate();
			Config[array[i]].selectCluster.activate();
		}
	}
}

/**
 * @note 检验经纬度坐标
 * @author 吴义迪
 * @create_time 2017-07-04
 */
function checkoutGeometryPoint(lon, lat){
	if(isNaN(lon) == true || isNaN(lat) == true){
		return false;
	}
	if(lon < Global.common.minLon || lon > Global.common.maxLon || lat < Global.common.minLat || lat > Global.common.maxLat){
		return false;
	}
	return true;
}

/**
 * @note 加载rest发布图层
 * @author 吴义迪
 * @create_time 2017-07-15
 */
function loadRestLayer(id, showType){
	var url = $("#tree_li_"+id+"").attr("layerurl");
	layer = new SuperMap.Layer.TiledDynamicRESTLayer("layer_"+id+"", Global.common.iserverPath+url, {transparent: true, cacheEnabled:true}, {projection:"EPSG:4326"});
	var data = {layer:layer, showType:showType};
	layer.events.on(
		{
			"layerInitialized": addlayerByTree,
			scope: data
		}
	);
}

/**
 * @note 加载图层（监听事件）
 * @author 吴义迪
 * @create_time 2017-07-15
 */
function addlayerByTree(){
	Global.common.map.addLayer(this.layer);
	if(this.showType == "restLine"){
		var left = this.layer.maxExtent.left;
		var bottom = this.layer.maxExtent.bottom;
		var right = this.layer.maxExtent.right;
		var top = this.layer.maxExtent.top;
		Global.common.map.zoomToExtent(new SuperMap.Bounds(left,bottom,right,top));
	}
	Global.common.selectFeature.setLayer(Global.common.selectFeatureLayers);
	if(this.showType == "rest"){
		layerIndexControl(this.layer);
	}
}

/**
 * @note 清除所有图层
 * @author 吴义迪
 * @create_time 2017-07-05
 */
function closeAllLayers(){	
	$(".scrollContentDiv .check_box[layerid]").each(function(){
		var id = this.attributes.layerid.nodeValue;	
		if($("#tree_li_"+id+"_img4").css("display") != "none" && $("#tree_li_"+id+"_img4").css("display") != null){
			$("#tree_li_"+id+"_img3").show();
			$("#tree_li_"+id+"_img4").hide();
			$("#zhfw-zt-legend-span1").hide(); //图例隐藏			
			closeLayer(id);			
		}
	});	
}

/**
 * @note 图层显示优先级控制（将地名置于面图之上）
 * @param layer：目标排序图层
 * @author 吴义迪
 * @create_time 2017-07-06
 */
function layerIndexControl(layer){
	var index = Global.common.map.getLayerIndex(Global.common.borderLayer);
	Global.common.map.setLayerIndex(layer, index);
}

/**
 * @note 添加标题进标题数组
 * @author 吴义迪
 * @create_time 2017-07-25
 */
function addTitle(id){
	var title = {};
	title.id = id;
	title.time = null;
	var areaName = Global.common.areaName;
	if(Config[id] && Config[id].layerTitleArea != null && Config[id].layerTitleArea == false){
		areaName = "";
	}
	if(Config[id] && Config[id].layerTitle){
		title.text = areaName + Config[id].layerTitle;
	}
	if(Config.layerType9.indexOf(","+id+",") > -1){
		title.text = areaName + $("#advancedQuery_type_div"+$("#advancedQuery_time_"+id+">span[flag='1']").attr("index")+"_"+id+">span[flag='1']").html() + "实况图";
		if(Global.common.param1.split(",")[1] == "YEAR"){
			var startime = $("#timeAxis_input").val().substring(0, 4);
			title.time = getMapTitleTime(startime);
		}else if(Global.common.param1.split(",")[1] == "MONTH"){
			var startime = $("#timeAxis_input").val().substring(0, 7);
			title.time = getMapTitleTime(startime);
		}else if(Global.common.param1.split(",")[1] == "DAY"){
			var startime = $("#timeAxis_input").val().substring(0, 10);
			title.time = getMapTitleTime(startime);
		}else if(Global.common.param1.split(",")[1] == "HOUR"){
			var startime = $("#timeAxis_input").val().substring(0, 13);
			title.time = getMapTitleTime(startime);
		}else if(Global.common.param1.split(",")[1] == "TENDAYS"){
			var startime = $("#timeAxis_input").val().substring(0, 10);
			title.time = getMapTitleTime(startime);
		}else if(Global.common.param1.split(",")[1] == "YUBAO"){
			var startime = $("#timeAxis_input").val();
			title.time = getMapTitleTime(startime);
		}
	}else if(Config.layerType10.indexOf(","+id+",") > -1){
		title.text = areaName + $("#advancedQuery_type_"+id+">span[flag='1']").html() + Config[id].layerTitle;
		title.time = getMapTitleTime(timeFormat1(new Date()).substring(0,10))+"08时次" + "&nbsp;时效" + (parseInt(Config[id].valid)+1)*3;
	}else if(Config.layerType11.indexOf(","+id+",") > -1){
		var startime = $("#timeAxis_input").val().substring(0, 13);
		title.time = getMapTitleTime(startime);
	}else if(Config.layerType6.indexOf(","+id+",") > -1 || Config.layerType7.indexOf(","+id+",") > -1){
		var startime = $("#timeAxis_input").val().substring(0, 10) + " " + $("#wu-time-content>.time_li[flag='1']").attr("data");
		title.time = getMapTitleTime(startime);
	}
	
	if(Config[id] && Config[id].timeFlag == "interval"){
		var time1 = $("#beginTime_input").val();
		var time2 = $("#endTime_input").val();
		title.time = getMapTitleTime(time1, time2);
	}
	for(var i=0; i<Global.common.title.length; i++){
		if(Global.common.title[i].id == id){
			Global.common.title.splice(i--, 1);
			break;
		}
	}
	Global.common.title.push(title);
}

/**
 * 获取地图图层标题标准时间的方法
 * 参数startime、endtime（开始时间、结束时间）的格式为YYYY-MM-DD
 * 若时间不为时间段，是单个时间点，则只需传入startime的值，endtime为null即可
 * 若无时间参数，则将startime、endtime都传为null即可
 * 返回字符串机制：
 * 1.若不同年：2015年10月07日 - 2016年10月07日
 * 2.若同年不同月：2016年09月07日 - 10月07日
 * 3.若同年同月： 2016年10月07日 - 09日
 */
function getMapTitleTime(startime, endtime){
	//如果开始时间与结束时间都不为空（即传入的为时间段）
	if(startime != null && endtime != null){
		//若传入的参数为年-月-日-时-分-秒
		if(startime.length == 19 && endtime.length == 19){
			//若开始开始时间与结束时间同年
			if(startime.substring(0, 4) == endtime.substring(0, 4)){
				//若开始开始时间与结束时间同年同月
				if(startime.substring(5, 7) == endtime.substring(5, 7)){
					//若开始开始时间与结束时间同年同月同日
					if(startime.substring(8, 10) == endtime.substring(8, 10)){
						//若开始开始时间与结束时间同年同月同日同时
						if(startime.substring(11, 13) == endtime.substring(11, 13)){
							//若开始开始时间与结束时间同年同月同日同时同分
							if(startime.substring(14, 16) == endtime.substring(14, 16)){
								return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" + startime.substring(11, 13) + "时" + startime.substring(14, 16) + "分" + startime.substring(17, 19) + "秒" +
								       " - " +
								       endtime.substring(17, 19) + "秒";
							}else{
								return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" + startime.substring(11, 13) + "时" + startime.substring(14, 16) + "分" + startime.substring(17, 19) + "秒" +
								       " - " +
								       endtime.substring(14, 16) + "分" + endtime.substring(17, 19) + "秒";
							}
						}else{
							return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" + startime.substring(11, 13) + "时" + startime.substring(14, 16) + "分" + startime.substring(17, 19) + "秒" +
							       " - " +
							       endtime.substring(11, 13) + "时"  + endtime.substring(14, 16) + "分" + endtime.substring(17, 19) + "秒";
						}
					}
					//若开始开始时间与结束时间同年同月不同日
					else{
						return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" + startime.substring(11, 13) + "时" + startime.substring(14, 16) + "分" + startime.substring(17, 19) + "秒" +
						       " - " +
						       endtime.substring(8, 10) + "日" + endtime.substring(11, 13) + "时"  + endtime.substring(14, 16) + "分" + endtime.substring(17, 19) + "秒";
					}
				}
				//若开始开始时间与结束时间同年不同月
				else{
					return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" + startime.substring(11, 13) + "时" + startime.substring(14, 16) + "分" + startime.substring(17, 19) + "秒" +
				           " - " +
				           endtime.substring(5, 7) + "月" + endtime.substring(8, 10) + "日" + endtime.substring(11, 13) + "时"  + endtime.substring(14, 16) + "分" + endtime.substring(17, 19) + "秒";
				}
			}
			//若开始开始时间与结束时间不同年
			else{
				return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" + startime.substring(11, 13) + "时" + startime.substring(14, 16) + "分" + startime.substring(17, 19) + "秒" +
				       " - " +
				       endtime.substring(0, 4) + "年" + endtime.substring(5, 7) + "月" + endtime.substring(8, 10) + "日" + endtime.substring(11, 13) + "时"  + endtime.substring(14, 16) + "分" + endtime.substring(17, 19) + "秒";
			}
		}
		//若传入的参数为年-月-日-时-分
		else if(startime.length == 16 && endtime.length == 16){
			
		}
		//若传入的参数为年-月-日-时
		else if(startime.length == 13 && endtime.length == 13){
			//若开始开始时间与结束时间同年
			if(startime.substring(0, 4) == endtime.substring(0, 4)){
				//若开始开始时间与结束时间同年同月
				if(startime.substring(5, 7) == endtime.substring(5, 7)){
					//若开始开始时间与结束时间同年同月同日
					if(startime.substring(8, 10) == endtime.substring(8, 10)){
						return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" + startime.substring(11, 13) + "时" +
						       " - " +
						       endtime.substring(11, 13) + "时";
					}
					//若开始开始时间与结束时间同年同月不同日
					else{
						return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" + startime.substring(11, 13) + "时" +
						       " - " +
						       endtime.substring(8, 10) + "日" + endtime.substring(11, 13) + "时";
					}
				}
				//若开始开始时间与结束时间同年不同月
				else{
					return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" + startime.substring(11, 13) + "时" +
				           " - " +
				           endtime.substring(5, 7) + "月" + endtime.substring(8, 10) + "日" + endtime.substring(11, 13) + "时";
				}
			}
			//若开始开始时间与结束时间不同年
			else{
				return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" + startime.substring(11, 13) + "时" +
				       " - " +
				       endtime.substring(0, 4) + "年" + endtime.substring(5, 7) + "月" + endtime.substring(8, 10) + "日" + endtime.substring(11, 13) + "时";
			}
		}
		//若传入的参数为年-月-日
		else if(startime.length == 10 && endtime.length == 10){
			//若开始开始时间与结束时间同年
			if(startime.substring(0, 4) == endtime.substring(0, 4)){
				//若开始开始时间与结束时间同年同月
				if(startime.substring(5, 7) == endtime.substring(5, 7)){
					return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" +
					       " - " +
					       endtime.substring(8, 10) + "日";
				}
				//若开始开始时间与结束时间同年不同月
				else{
					return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" +
				           " - " +
				           endtime.substring(5, 7) + "月" + endtime.substring(8, 10) + "日";
				}
			}
			//若开始开始时间与结束时间不同年
			else{
				return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" +
				       " - " +
				       endtime.substring(0, 4) + "年" + endtime.substring(5, 7) + "月" + endtime.substring(8, 10) + "日";
			}
		}
		//若传入的参数为年-月
		else if(startime.length == 7 && endtime.length == 7){
			//若开始开始时间与结束时间同年
			if(startime.substring(0, 4) == endtime.substring(0, 4)){
				return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" +
			           " - " +
			           endtime.substring(5, 7) + "月";
			}
			//若开始开始时间与结束时间不同年
			else{
				return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" +
				       " - " +
				       endtime.substring(0, 4) + "年" + endtime.substring(5, 7) + "月";
			}
		}
		//若传入的参数为年
		else if(startime.length == 4 && endtime.length == 4){
			return startime.substring(0, 4) + "年" +
			       " - " +
			       endtime.substring(0, 4) + "年";
		}
		//传入的时间参数格式不符合要求
		else{
			console.info("getMapTitleTime方法-传入的时间参数格式不符合要求");
			return null;
		}
	}
	//如果开始时间不为空，结束时间为空（即传入的为时间点）
	else if(startime != null && endtime == null){
		//若传入的参数为年-月-日-时-分
		if(startime.length == 16){
			return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" + startime.substring(11, 13) + "时" + startime.substring(14, 16) + "分";
		}
		//若传入的参数为年-月-日-时
		else if(startime.length == 13){
			return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日" + startime.substring(11, 13) + "时";
		}
		//若传入的参数为年-月-日
		else if(startime.length == 10){
			return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月" + startime.substring(8, 10) + "日";
		}
		//若传入的参数为年-月
		else if(startime.length == 7){
			return startime.substring(0, 4) + "年" + startime.substring(5, 7) + "月";
		}
		//若传入的参数为年
		else if(startime.length == 4){
			return startime.substring(0, 4) + "年";
		}
		//传入的时间参数格式不符合要求
		else{
			console.info("getMapTitleTime方法-传入的时间参数格式不符合要求");
			return null;
		}
	}
	//如果开始时间、结束时间都为空
	else if(startime == null && endtime == null){
		return null;
	}
	//传入的时间参数格式不符合要求
	else{
		console.info("getMapTitleTime方法-传入的时间参数格式不符合要求");
		return null;
	}
}

/**
 * @note 添加时间轴进时间轴数组
 * @author 吴义迪
 * @create_time 2017-07-26
 */
function addTimeAxis(id){
	var timeAxis = {};
	timeAxis.id = id;
	for(var i=0; i<Global.common.timeAxis.length; i++){
		if(Global.common.timeAxis[i].id == id){
			Global.common.timeAxis.splice(i--, 1);
			break;
		}
	}
	Global.common.timeAxis.push(timeAxis);
}

/**
 * @note 添加图例进数组
 * @author 吴义迪
 * @create_time 2017-07-27
 */
function addLegend(id){
	var legend = {};
	legend.id = id;
	for(var i=0; i<Global.common.legend.length; i++){
		if(Global.common.legend[i].id == id){
			Global.common.legend.splice(i--, 1);
			break;
		}
	}
	Global.common.legend.push(legend);
}

/**
 * @note 地图标题方法
 * @author 吴义迪
 * @create_time 2017-07-25
 */
function mapTitleFunc(){
	$("#map_title_text").html("");
	$("#map_title_time").html("");
	if(Global.common.title.length <= 0){
		$("#map_title").hide();
		return;
	}else{
		var title = "";
		if($(".zhfw-kuaijie>span[flag='1']").length <= 0){
			title = Global.common.title[Global.common.title.length-1];
		}else{
			title = Global.common.kjTitle;
		}
		if(title.text != null || title.time != null){
			//根据屏幕分辨率对标题字体大小进行设定
			if($(window).width() < 1400){
				$("#map_title_text").css("font-size", "19px");
				$("#map_title_time").css("font-size", "16px");
			}else if($(window).width() >= 1400 && $(window).width() < 1600){
				$("#map_title_text").css("font-size", "20px");
				$("#map_title_time").css("font-size", "17px");
			}else if($(window).width() >= 1600 && $(window).width() < 1900){
				$("#map_title_text").css("font-size", "21px");
				$("#map_title_time").css("font-size", "18px");
			}else if($(window).width() >= 1900){
				$("#map_title_text").css("font-size", "24px");
				$("#map_title_time").css("font-size", "19px");
			}
			if(title.text != null){
				$("#map_title_text").html(title.text);
			}
			if(title.time != null){
				$("#map_title_time").html(title.time);
			}
			//设置地图标题左偏移量
			$("#map_title").css("left", ($(window).width() - $("#map_title").outerWidth())/2 + "px");
			if($("#header_menus_title").attr("flag") == "0"){
				$("#map_title").show();
			}
		}
	}
}

/**
 * @note 删除标题数组
 * @author 吴义迪
 * @create_time 2017-07-25
 */
function removeTitle(id){
	for(var i=0; i<Global.common.title.length; i++){
		if(Global.common.title[i].id == id){
			Global.common.title.splice(i--, 1);
			break;
		}
	}
}

/**
 * @note 删除时间轴数组
 * @author 吴义迪
 * @create_time 2017-07-25
 */
function removeTimeAxis(id){
	var flag = false;
	for(var i=0; i<Global.common.timeAxis.length; i++){
		if(Global.common.timeAxis[i].id == id){
			flag = true;
			Global.common.timeAxis.splice(i--, 1);
			break;
		}
	}
	if(Global.common.timeAxis.length <= 0){
		//播放停止
		if($(".time-stop").css("display") != "none" && $(".time-stop").css("display") != null){
			timeAxisStopFunc();
		}
		//隐藏时间轴
		$("#wu-time-line-shadow").hide();
		$("#wu-time-line-time").hide();
		$(".play-stop").css("display", "none");
		$(".play-left").css("display", "none");
		$(".play-right").css("display", "none");
		$(".play-time").css("display", "none");
		$(".time-line-show").css("display", "none");
		$(".time-line-hid").css("display", "none");
		$(".time-check").css("bottom", "");
		return;
	}else{
		if(flag == true){
			if(Config[Global.common.timeAxis[Global.common.timeAxis.length-1].id].time != null){
				$("#timeAxis_input").val(Config[Global.common.timeAxis[Global.common.timeAxis.length-1].id].time);
				Global.common.timeAxisType = Config[Global.common.timeAxis[Global.common.timeAxis.length-1].id].timeAxisType;
			}
			if(Config[Global.common.timeAxis[Global.common.timeAxis.length-1].id].timeHtml != null){
				$("#wu-time-content").html(Config[Global.common.timeAxis[Global.common.timeAxis.length-1].id].timeHtml);
				$("#wu-time-line-content").html($("#wu-time-content>.time_li[flag='1']").attr("data"));
			}
		}
	}
}

/**
 * @note 删除图例数组
 * @author 吴义迪
 * @create_time 2017-07-27
 */
function removeLegend(id){
	for(var i=0; i<Global.common.legend.length; i++){
		if(Global.common.legend[i].id == id){
			Global.common.legend.splice(i--, 1);
			break;
		}
	}
	if(Global.common.legend.length <= 0){
		//隐藏图例
		$("#legend-shadow").hide();
		$("#legend-line").hide();
		$(".legend-img").css("display", "none");
		$(".legend-show").css("display", "none");
		$(".legend-hid").css("display", "none");
		return;
	}else{
		initLegend(Global.common.legend[Global.common.legend.length-1].id);
	}
}

/**
 * @note 初始化时间轴
 * @author 陈靖宇
 * @create_time 2018-07-16
 */
function initTime(id, value, index, index1, showType){
	//显示时间轴
	$("#wu-time-line-shadow").show();
	$("#wu-time-line-time").hide();
	$(".play-stop").css("display", "inline-block");
	$(".play-left").css("display", "inline-block");
	$(".play-right").css("display", "inline-block");
	$(".play-time").css("display", "inline-block");
	$(".time-line-show").css("display", "none");
	$(".time-line-hid").css("display", "inline-block");
	if($(".time-check").is(":visible")){
		$(".time-check").css("bottom", "50px");
	}
	//播放停止
	if($(".time-stop").css("display") != "none" && $(".time-stop").css("display") != null){
		timeAxisStopFunc();
	}
	for(var i=0; i<Global.common.timeAxis.length; i++){
		if(Global.common.timeAxis[i].id == id){
			Global.common.timeAxis[i].value = value;
			break;
		}
	}
	var width = $("#wu-time-content").width()/(value.length) - 2;
	var html = "";
	for(var i=0; i<value.length; i++){
		var time = "";
		if((i+1) % index1 == 0){
			time = value[i].time;
		}
		html += "<li class=\"time_li\" name=\"time_li\" flag=\"0\" index=\""+i+"\" data=\""+value[i].time+"\" data1=\""+value[i].flag+"\">" +
				"	<div class=\"time_poi\" name=\"time_poi\" index=\""+i+"\"></div>" +
				"	<div class=\"time_note\" name=\"time_note\" index=\""+i+"\"></div>" +
				"	<span class=\"time_span\" name=\"time_span\" index=\""+i+"\">"+time+"</span>" +
				"	<i class=\"time_i\" name=\"time_i\" index=\""+i+"\"></i>" +
				"</li>";
	}
	$("#wu-time-content").html(html);
	$(".time_li").width(width);
	$("#wu-time-content>.time_li:eq("+index+")").attr("flag", "1");
	if(showType == true){
		$("#wu-time-content>.time_li:lt("+(index+1)+")>i").css("background", "#ff8c00");
	}else{
		$("#wu-time-content>.time_li:eq("+index+")>i").css("background", "#ff8c00");
	}
	$("#wu-time-content>.time_li>.time_poi:eq("+index+")").show();
	$("#wu-time-line-content").html($("#wu-time-content>.time_li:eq("+index+")").attr("data"));
	var time = $("#timeAxis_input").val().substring(0, 10).replace(/[^0-9]/ig,"");
	// Config[id].timeHtml = $("#wu-time-content").html();
}

/**
 * @note 初始化时间轴
 * @author 吴义迪
 * @create_time 2017-07-25
 */
function initTimeAxis(id, value, index, index1, showType){
	Config[id].timeAxisShowType = showType;
	//显示时间轴
	$("#wu-time-line-shadow").show();
	$("#wu-time-line-time").hide();
	$(".play-stop").css("display", "inline-block");
	$(".play-left").css("display", "inline-block");
	$(".play-right").css("display", "inline-block");
	$(".play-time").css("display", "inline-block");
	$(".time-line-show").css("display", "none");
	$(".time-line-hid").css("display", "inline-block");
	if($(".time-check").is(":visible")){
		$(".time-check").css("bottom", "50px");
	}
	if( Global.common.timeAxisType.toUpperCase() == "TENDAYS" || Global.common.timeAxisType.toUpperCase() == "YUBAO" ){
		$(".play-time").css("display", "none");
	}
	//播放停止
	if($(".time-stop").css("display") != "none" && $(".time-stop").css("display") != null){
		timeAxisStopFunc();
	}
	for(var i=0; i<Global.common.timeAxis.length; i++){
		if(Global.common.timeAxis[i].id == id){
			Global.common.timeAxis[i].value = value;
			break;
		}
	}
	var width = $("#wu-time-content").width()/(value.length) - 2;
	var html = "";
	for(var i=0; i<value.length; i++){
		var time = "";
		if((i+1) % index1 == 0){
			time = value[i].time;
		}
		html += "<li class=\"time_li\" name=\"time_li\" flag=\"0\" index=\""+i+"\" data=\""+value[i].time+"\" data1=\""+value[i].flag+"\">" +
				"	<div class=\"time_poi\" name=\"time_poi\" index=\""+i+"\"></div>" +
				"	<div class=\"time_note\" name=\"time_note\" index=\""+i+"\"></div>" +
				"	<span class=\"time_span\" name=\"time_span\" index=\""+i+"\">"+time+"</span>" +
				"	<i class=\"time_i\" name=\"time_i\" index=\""+i+"\"></i>" +
				"</li>";
	}
	$("#wu-time-content").html(html);
	$(".time_li").width(width);
	$("#wu-time-content>.time_li:eq("+index+")").attr("flag", "1");
	if(showType == true){
		$("#wu-time-content>.time_li:lt("+(index+1)+")>i").css("background", "#ff8c00");
	}else{
		$("#wu-time-content>.time_li:eq("+index+")>i").css("background", "#ff8c00");
	}
	$("#wu-time-content>.time_li>.time_poi:eq("+index+")").show();
	$("#wu-time-line-content").html($("#wu-time-content>.time_li:eq("+index+")").attr("data"));
	Config[id].time = $("#timeAxis_input").val();
	Config[id].timeHtml = $("#wu-time-content").html();
}

/**
 * @note 初始化图例
 * @author 吴义迪
 * @create_time 2017-07-27
 */
function initLegend(id){
	//显示图例
	$("#legend-shadow").show();
	$("#legend-line").hide();
	$(".legend-img").css("display", "inline-block");
	$(".legend-show").css("display", "none");
	$(".legend-hid").css("display", "inline-block");
	var color = $("#tree_ul_"+id+"").attr("colors").split(";");
	var levels = $("#tree_ul_"+id+"").attr("levels").split(",");
	var unit = $("#tree_ul_"+id+"").attr("unit");
	var html = "";
	html += "<span class=\"legend_span2\">"+($("#tree_li_"+id+"").attr("layername"))+"("+unit+")</span>";
	for(var i=0; i<color.length; i++){
		html += "<span class=\"legend_span\" style=\"background:"+color[i]+"\"></span>";
	}
	html += "<br>";
	for(var i=0; i<levels.length; i++){
		if(levels[i].indexOf("~") > -1){
			var levelsArr = levels[i].split("~");
			if(levels[0].split("~")[0] > levels[1].split("~")[0] && i<levels.length-1){
				if(i == 0){
					html += "<span class=\"legend_span1 legend_span1_first\">"+levelsArr[0]+"</span>";
				}else{
					html += "<span class=\"legend_span1\">"+levelsArr[0]+"</span>";
				}
			}else if(i<levels.length-1){
				if(i == 0){
					html += "<span class=\"legend_span1 legend_span1_first\">"+levelsArr[1]+"</span>";
				}else{
					html += "<span class=\"legend_span1\">"+levelsArr[1]+"</span>";
				}
			}
		}else{
			if(i == 0){
				html += "<span class=\"legend_span1 legend_span1_first\">"+levels[i]+"</span>";
			}else{
				html += "<span class=\"legend_span1\">"+levels[i]+"</span>";
			}
		}
	}
	$("#legend-content").html(html);
	var marginLeft = $(".legend_span2").outerWidth() + 23;
	$(".legend_span1_first").css("marginLeft", marginLeft+"px");
	$(".legend-hid").css("left", ($("#legend-shadow").width() + 10) + "px");
	$("#legend-content>.legend_span").css("opacity", parseInt($("#tree_li_"+id+"").attr("opacity"))*0.01);
	
}

/**
 * @note 时间轴点击事件
 * @author 吴义迪
 * @create_time 2017-07-25
 */
function timeAxisClickFunc(e){
	e = e || window.event;
	if((e.target.attributes.name && e.target.attributes.name.nodeValue == "time_li") ||
	   (e.target.parentNode.attributes.name && e.target.parentNode.attributes.name.nodeValue == "time_li")){
		var index = parseInt(e.target.attributes.index.nodeValue);
		var id = Global.common.timeAxis[Global.common.timeAxis.length-1].id;
		$("#wu-time-content>.time_li").attr("flag", "0");
		$("#wu-time-content>.time_li:eq("+index+")").attr("flag", "1");
		$("#wu-time-content>.time_li>.time_poi").hide();
		$("#wu-time-content>.time_li>.time_poi:eq("+index+")").show();
		$("#wu-time-content>.time_li>i").css("background", "");
		if(Config[id].timeAxisShowType == true){
			$("#wu-time-content>.time_li:lt("+(index+1)+")>i").css("background", "#ff8c00");
		}else{
			$("#wu-time-content>.time_li:eq("+index+")>i").css("background", "#ff8c00");
		}
		$("#wu-time-line-content").html($("#wu-time-content>.time_li:eq("+index+")").attr("data"));
		if(Global.common.timeAxisType == "YEAR"){
			$("#timeAxis_input").val($("#wu-time-content>.time_li:eq("+index+")").attr("data1") + $("#timeAxis_input").val().substring(4));
		}else if(Global.common.timeAxisType == "MONTH"){
			$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,5) + $("#wu-time-content>.time_li:eq("+index+")").attr("data1") + $("#timeAxis_input").val().substring(7));
		}else if(Global.common.timeAxisType == "DAY"){
			$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,8) + $("#wu-time-content>.time_li:eq("+index+")").attr("data1") + $("#timeAxis_input").val().substring(10));
		}else if(Global.common.timeAxisType == "TENDAYS"){
			$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,5) + $("#wu-time-content>.time_li:eq("+index+")").attr("data1") + $("#timeAxis_input").val().substring(10));
		}else if(Global.common.timeAxisType == "YUBAO"){
			$("#timeAxis_input").val($("#wu-time-content>.time_li:eq("+index+")").attr("data1"));
		}else{
			
		}
		Config[id].timeHtml = $("#wu-time-content").html();
		Config[id].time = $("#timeAxis_input").val();
		if(Config.layerType10.indexOf(","+id+",") > -1){
			Config[id].valid = $("#wu-time-content>.time_li:eq("+index+")").attr("data1");
			loadLayer(id);
		}else if( id == "58"){
			Global.common.time = $("#timeAxis_input").val().substring(0, 10);
			addTimeAxis(id);
			requestNPointLayer($('#farmselect').val());
		} else if( id == "233" ){
			Global.common.time = $("#timeAxis_input").val().substring(0, 10);
			addTimeAxis(id);
			requestZPointLayer($('#farmselect').val());
		} else{
			loadLayer(id);
		}
	}
}

/**
 * @note 时间轴播放事件
 * @author 吴义迪
 * @create_time 2017-07-26
 */
function timeAxisPlayFunc(e){
	var id = Global.common.timeAxis[Global.common.timeAxis.length-1].id;
	if (Config.layerType11.indexOf(","+id+",") > -1){
		alert("该图层不支持播放效果");
		return;
	}
	$(".time-play").css("display", "none");
    $(".time-stop").css("display", "block");
    var interval = 1000;
	Global.common.timeInterval1 = setInterval(timeAxisRightFunc, interval);
}

/**
 * @note 时间轴播放停止事件
 * @author 吴义迪
 * @create_time 2017-07-26
 */
function timeAxisStopFunc(e){
	$(".time-stop").css("display", "none");
    $(".time-play").css("display", "block");
	clearInterval(Global.common.timeInterval1);
	if(Global.common.timeAxis.length-1 >= 0){
		var id = Global.common.timeAxis[Global.common.timeAxis.length-1].id;
		Config[id].timeHtml = $("#wu-time-content").html();
		Config[id].time = $("#timeAxis_input").val();
	}
}

/**
 * @note 时间轴左翻事件
 * @author 吴义迪
 * @create_time 2018-01-03
 */
function timeAxisLeftFunc(){
	var index = parseInt($("#wu-time-content>.time_li[flag='1']").attr("index")) - 1;
	var id = Global.common.timeAxis[Global.common.timeAxis.length-1].id;
	if(index < 0){
		index = $("#wu-time-content>.time_li").length - 1;
	}
	$("#wu-time-content>.time_li").attr("flag", "0");
	$("#wu-time-content>.time_li:eq("+index+")").attr("flag", "1");
	$("#wu-time-content>.time_li>.time_poi").hide();
	$("#wu-time-content>.time_li>.time_poi:eq("+index+")").show();
	$("#wu-time-content>.time_li>i").css("background", "");
	if(Config[id].timeAxisShowType == true){
		$("#wu-time-content>.time_li:lt("+(index+1)+")>i").css("background", "#ff8c00");
	}else{
		$("#wu-time-content>.time_li:eq("+index+")>i").css("background", "#ff8c00");
	}
	$("#wu-time-line-content").html($("#wu-time-content>.time_li:eq("+index+")").attr("data"));
	if(Global.common.timeAxisType == "YEAR"){
		$("#timeAxis_input").val($("#wu-time-content>.time_li:eq("+index+")").attr("data1") + $("#timeAxis_input").val().substring(4));
	}else if(Global.common.timeAxisType == "MONTH"){
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,5) + $("#wu-time-content>.time_li:eq("+index+")").attr("data1") + $("#timeAxis_input").val().substring(7));
	}else if(Global.common.timeAxisType == "DAY"){
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,8) + $("#wu-time-content>.time_li:eq("+index+")").attr("data1") + $("#timeAxis_input").val().substring(10));
	}else if(Global.common.timeAxisType == "HOUR"){
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,11) + $("#wu-time-content>.time_li:eq("+index+")").attr("data1") + $("#timeAxis_input").val().substring(13));
	}else if(Global.common.timeAxisType == "TENDAYS"){
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,5) + $("#wu-time-content>.time_li:eq("+index+")").attr("data1") + $("#timeAxis_input").val().substring(10));
	}else if(Global.common.timeAxisType == "YUBAO"){
		$("#timeAxis_input").val($("#wu-time-content>.time_li:eq("+index+")").attr("data1"));
	}else{
		
	}
	Config[id].timeHtml = $("#wu-time-content").html();
	Config[id].time = $("#timeAxis_input").val();
	if(Config.layerType10.indexOf(","+id+",") > -1){
		Config[id].valid = $("#wu-time-content>.time_li:eq("+index+")").attr("data1");
		loadLayer(id);
	} else if( id == "58" ){
		Global.common.time = $("#timeAxis_input").val().substring(0, 10);
		addTimeAxis(id);
		requestNPointLayer($('#farmselect').val());
	} else if( id == "233" ){
		Global.common.time = $("#timeAxis_input").val().substring(0, 10);
		addTimeAxis(id);
		requestZPointLayer($('#farmselect').val());
	} else{
		loadLayer(id);
	}
}

/**
 * @note 时间轴右翻事件
 * @author 吴义迪
 * @create_time 2018-01-03
 */
function timeAxisRightFunc(){
	var index = parseInt($("#wu-time-content>.time_li[flag='1']").attr("index")) + 1;
	var id = Global.common.timeAxis[Global.common.timeAxis.length-1].id;
	if(index >= $("#wu-time-content>.time_li").length){
		index = 0;
	}
	$("#wu-time-content>.time_li").attr("flag", "0");
	$("#wu-time-content>.time_li:eq("+index+")").attr("flag", "1");
	$("#wu-time-content>.time_li>.time_poi").hide();
	$("#wu-time-content>.time_li>.time_poi:eq("+index+")").show();
	$("#wu-time-content>.time_li>i").css("background", "");
	if(Config[id].timeAxisShowType == true){
		$("#wu-time-content>.time_li:lt("+(index+1)+")>i").css("background", "#ff8c00");
	}else{
		$("#wu-time-content>.time_li:eq("+index+")>i").css("background", "#ff8c00");
	}
	$("#wu-time-line-content").html($("#wu-time-content>.time_li:eq("+index+")").attr("data"));
	if(Global.common.timeAxisType == "YEAR"){
		$("#timeAxis_input").val($("#wu-time-content>.time_li:eq("+index+")").attr("data1") + $("#timeAxis_input").val().substring(4));
	}else if(Global.common.timeAxisType == "MONTH"){
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,5) + $("#wu-time-content>.time_li:eq("+index+")").attr("data1") + $("#timeAxis_input").val().substring(7));
	}else if(Global.common.timeAxisType == "DAY"){
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,8) + $("#wu-time-content>.time_li:eq("+index+")").attr("data1") + $("#timeAxis_input").val().substring(10));
	}else if(Global.common.timeAxisType == "HOUR"){
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,11) + $("#wu-time-content>.time_li:eq("+index+")").attr("data1") + $("#timeAxis_input").val().substring(13));
	}else if(Global.common.timeAxisType == "TENDAYS"){
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,5) + $("#wu-time-content>.time_li:eq("+index+")").attr("data1") + $("#timeAxis_input").val().substring(10));
	}else if(Global.common.timeAxisType == "YUBAO"){
		$("#timeAxis_input").val($("#wu-time-content>.time_li:eq("+index+")").attr("data1"));
	}else{
		
	}
	Config[id].timeHtml = $("#wu-time-content").html();
	Config[id].time = $("#timeAxis_input").val();
	if(Config.layerType10.indexOf(","+id+",") > -1){
		Config[id].valid = $("#wu-time-content>.time_li:eq("+index+")").attr("data1");
		loadLayer(id);
	} else if( id == "58" ){
		Global.common.time = $("#timeAxis_input").val().substring(0, 10);
		addTimeAxis(id);
		requestNPointLayer($('#farmselect').val());
	} else if( id == "233" ){
		Global.common.time = $("#timeAxis_input").val().substring(0, 10);
		addTimeAxis(id);
		requestZPointLayer($('#farmselect').val());
	} else{
		loadLayer(id);
	}
}

/**
 * @note 时间轴展开
 * @author 吴虹
 * @create_time 2017-07-25
 */
function showSideBar() {
	$('.time-line-show').hide();
    $('.time-line-hid').show();
    $('#wu-time-line-time').hide();
    $('#wu-time-line-shadow').show();
}

/**
 * @note 时间轴收起
 * @author 吴虹
 * @create_time 2017-07-25
 */
function hideSideBar() {
	$('.time-line-hid').hide();
    $('.time-line-show').show();
    $('#wu-time-line-time').show();
    $('#wu-time-line-shadow').hide();
}

/**
 * @note 图例展开
 * @author 吴义迪
 * @create_time 2017-07-27
 */
function showSideLegend() {
	$('.legend-show').hide();
    $('.legend-hid').show();
    $('#legend-line').hide();
    $('#legend-shadow').show();
}

/**
 * @note 图例收起
 * @author 吴义迪
 * @create_time 2017-07-27
 */
function hideSideLegend() {
	$('.legend-hid').hide();
    $('.legend-show').show();
    $('#legend-line').show();
    $('#legend-shadow').hide();
}

/**
 * @note 浏览器加载图片
 * @author 吴义迪
 * @create_time 2017-07-26
 */
function loadImages(id){
	for(var i=0; i<Config[id].value.length; i++){
		var imgObj = new Image();
		imgObj.src = Config[id].value[i].url;
	}
}

/**
 * @note 快捷方式1
 * @author 吴义迪
 * @create_time 2017-07-28
 */
function qjfs1Func(){
	var ids = Config.kjLayers1;
	if(ids.length <= 0){
		return;
	}
	if($("#zhfw-qjfs1").attr("flag") == "1"){
		changeBaseLayer("ter");
		//清除其他专题图层
		var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
		if(arr.length > 0){
			closeZtLayers(arr[0].id);
		}
		$(".zhfw-kuaijie>.panel-heading-imgs>.panel-heading-imgname").css("color", "");
		$(".zhfw-kuaijie>.panel-heading-imgs>.img").css("background", "");
		
		Global.common.kjTitle = {"text":Global.common.areaName+"实况监测专题图"};
		$("#zhfw-qjfs1>.panel-heading-imgname").css("color", "#4187e7");
		//$(".panel-heading-imgs .img1").css("background", "rgba(240, 144, 86, 1)");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img4").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").hide();
				$("#tree_li_"+ids[i]+"_img4").show();
				loadLayer(ids[i]);
			}
		}
	}else{
		Global.common.kjTitle = null;
		$("#zhfw-qjfs1>.panel-heading-imgname").css("color", "");
		//$(".panel-heading-imgs .img1").css("background", "");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img3").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").show();
				$("#tree_li_"+ids[i]+"_img4").hide();
				closeLayer(ids[i]);
			}
		}
	}
}

/**
 * @note 快捷方式2
 * @author 吴义迪
 * @create_time 2017-07-28
 */
function qjfs2Func(){
	var ids = Config.kjLayers2;
	if(ids.length <= 0){
		return;
	}
	if($("#zhfw-qjfs2").attr("flag") == "1"){
		changeBaseLayer("ter");
		//清除其他专题图层
		var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
		if(arr.length > 0){
			closeZtLayers(arr[0].id);
		}
		$(".zhfw-kuaijie>.panel-heading-imgs>.panel-heading-imgname").css("color", "");
		$(".zhfw-kuaijie>.panel-heading-imgs>.img").css("background", "");
		
		Global.common.kjTitle = {"text":Global.common.areaName+"预报预警专题图"};
		$("#zhfw-qjfs2>.panel-heading-imgname").css("color", "#4187e7");
		//$(".panel-heading-imgs .img2").css("background", "rgba(73, 167, 218, 1)");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img4").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").hide();
				$("#tree_li_"+ids[i]+"_img4").show();
				loadLayer(ids[i]);
			}
		}
	}else{
		Global.common.kjTitle = null;
		$("#zhfw-qjfs2>.panel-heading-imgname").css("color", "");
		//$(".panel-heading-imgs .img2").css("background", "");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img3").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").show();
				$("#tree_li_"+ids[i]+"_img4").hide();
				closeLayer(ids[i]);
			}
		}
	}
}

/**
 * @note 快捷方式3
 * @author 吴义迪
 * @create_time 2017-07-28
 */
function qjfs3Func(){
	var ids = Config.kjLayers3;
	if(ids.length <= 0){
		return;
	}
	if($("#zhfw-qjfs3").attr("flag") == "1"){
		changeBaseLayer("ter");
		//清除其他专题图层
		var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
		if(arr.length > 0){
			closeZtLayers(arr[0].id);
		}
		$(".zhfw-kuaijie>.panel-heading-imgs>.panel-heading-imgname").css("color", "");
		$(".zhfw-kuaijie>.panel-heading-imgs>.img").css("background", "");
		
		Global.common.kjTitle = {"text":Global.common.areaName+"农情调查专题图"};
		$("#zhfw-qjfs3>.panel-heading-imgname").css("color", "#4187e7");
		//$(".panel-heading-imgs .img3").css("background", "rgba(145, 120, 175, 1)");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img4").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").hide();
				$("#tree_li_"+ids[i]+"_img4").show();
				loadLayer(ids[i]);
			}
		}
	}else{
		Global.common.kjTitle = null;
		$("#zhfw-qjfs3>.panel-heading-imgname").css("color", "");
		//$(".panel-heading-imgs .img3").css("background", "");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img3").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").show();
				$("#tree_li_"+ids[i]+"_img4").hide();
				closeLayer(ids[i]);
			}
		}
	}
}

/**
 * @note 快捷方式4
 * @author 吴义迪
 * @create_time 2017-07-28
 */
function qjfs4Func(){
	var ids = Config.kjLayers4;
	if(ids.length <= 0){
		return;
	}
	if($("#zhfw-qjfs4").attr("flag") == "1"){
		changeBaseLayer("ter");
		//清除其他专题图层
		var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
		if(arr.length > 0){
			closeZtLayers(arr[0].id);
		}
		$(".zhfw-kuaijie>.panel-heading-imgs>.panel-heading-imgname").css("color", "");
		$(".zhfw-kuaijie>.panel-heading-imgs>.img").css("background", "");
		
		Global.common.kjTitle = {"text":Global.common.areaName+"灾情调查专题图"};
		$("#zhfw-qjfs4>.panel-heading-imgname").css("color", "#4187e7");
		//$(".panel-heading-imgs .img4").css("background", "rgba(228, 97, 65, 1)");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img4").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").hide();
				$("#tree_li_"+ids[i]+"_img4").show();
				loadLayer(ids[i]);
			}
		}
	}else{
		Global.common.kjTitle = null;
		$("#zhfw-qjfs4>.panel-heading-imgname").css("color", "");
		//$(".panel-heading-imgs .img4").css("background", "");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img3").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").show();
				$("#tree_li_"+ids[i]+"_img4").hide();
				closeLayer(ids[i]);
			}
		}
	}
}

/**
 * @note 快捷方式5
 * @author 吴义迪
 * @create_time 2017-09-14
 */
function qjfs5Func(){
	var ids = Config.kjLayers5;
	if(ids.length <= 0){
		return;
	}
	if($("#zhfw-qjfs5").attr("flag") == "1"){
		changeBaseLayer("ter");
		//清除其他专题图层
		var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
		if(arr.length > 0){
			closeZtLayers(arr[0].id);
		}
		$(".zhfw-kuaijie>.panel-heading-imgs>.panel-heading-imgname").css("color", "");
		$(".zhfw-kuaijie>.panel-heading-imgs>.img").css("background", "");
		
		Global.common.kjTitle = {"text":"农业概况专题图"};
		$("#zhfw-qjfs5>.panel-heading-imgname").css("color", "#4187e7");
		//$(".panel-heading-imgs .img5").css("background", "rgba(238, 99, 107, 1)");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img4").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").hide();
				$("#tree_li_"+ids[i]+"_img4").show();
				loadLayer(ids[i]);
			}
		}
	}else{
		Global.common.kjTitle = null;
		$("#zhfw-qjfs5>.panel-heading-imgname").css("color", "");
		//$(".panel-heading-imgs .img5").css("background", "");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img3").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").show();
				$("#tree_li_"+ids[i]+"_img4").hide();
				closeLayer(ids[i]);
			}
		}
	}
}

/**
 * @note 快捷方式6
 * @author 吴义迪
 * @create_time 2017-09-14
 */
function qjfs6Func(){
	var ids = Config.kjLayers6;
	if(ids.length <= 0){
		return;
	}
	if($("#zhfw-qjfs6").attr("flag") == "1"){
		changeBaseLayer("ter");
		//清除其他专题图层
		var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
		if(arr.length > 0){
			closeZtLayers(arr[0].id);
		}
		$(".zhfw-kuaijie>.panel-heading-imgs>.panel-heading-imgname").css("color", "");
		$(".zhfw-kuaijie>.panel-heading-imgs>.img").css("background", "");
		
		Global.common.kjTitle = {"text":Global.common.areaName+"种植区分布专题图"};
		$("#zhfw-qjfs6>.panel-heading-imgname").css("color", "#4187e7");
		//$(".panel-heading-imgs .img6").css("background", "rgba(227, 226, 29, 1)");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img4").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").hide();
				$("#tree_li_"+ids[i]+"_img4").show();
				loadLayer(ids[i]);
			}
		}
	}else{
		Global.common.kjTitle = null;
		$("#zhfw-qjfs6>.panel-heading-imgname").css("color", "");
		//$(".panel-heading-imgs .img6").css("background", "");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img3").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").show();
				$("#tree_li_"+ids[i]+"_img4").hide();
				closeLayer(ids[i]);
			}
		}
	}
}

/**
 * @note 快捷方式7
 * @author 吴义迪
 * @create_time 2017-09-14
 */
function qjfs7Func(){
	var ids = Config.kjLayers7;
	if(ids.length <= 0){
		return;
	}
	if($("#zhfw-qjfs7").attr("flag") == "1"){
		changeBaseLayer("img");
		//清除其他专题图层
		var arr = $(".zhfw-kuaijie>.panel-heading-imgs[flag='1']");
		if(arr.length > 0){
			closeZtLayers(arr[0].id);
		}
		$(".zhfw-kuaijie>.panel-heading-imgs>.panel-heading-imgname").css("color", "");
		$(".zhfw-kuaijie>.panel-heading-imgs>.img").css("background", "");
		
		Global.common.kjTitle = {"text":Global.common.areaName+"生育期分布专题图"};
		$("#zhfw-qjfs7>.panel-heading-imgname").css("color", "#4187e7");
		//$(".panel-heading-imgs .img7").css("background", "rgba(87, 204, 206, 1)");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img4").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").hide();
				$("#tree_li_"+ids[i]+"_img4").show();
				loadLayer(ids[i]);
			}
		}
	}else{
		Global.common.kjTitle = null;
		$("#zhfw-qjfs7>.panel-heading-imgname").css("color", "");
		//$(".panel-heading-imgs .img7").css("background", "");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img3").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").show();
				$("#tree_li_"+ids[i]+"_img4").hide();
				closeLayer(ids[i]);
			}
		}
	}
}

/**
 * @note 快捷方式8
 * @author 吴义迪
 * @create_time 2017-09-14
 */
function qjfs8Func(){
	var ids = Config.kjLayers8;
	if(ids.length <= 0){
		return;
	}
	if($("#zhfw-qjfs8").attr("flag") == "1"){
		changeBaseLayer("ter");
		$(".zhfw-kuaijie>.panel-heading-imgs>.panel-heading-imgname").css("color", "");
		$(".zhfw-kuaijie>.panel-heading-imgs>.img").css("background", "");
		
		Global.common.kjTitle = {"text":Global.common.areaName+"相关设备专题图"};
		$("#zhfw-qjfs8>.panel-heading-imgname").css("color", "#4187e7");
		//$(".panel-heading-imgs .img8").css("background", "rgba(243, 62, 120, 1)");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img4").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").hide();
				$("#tree_li_"+ids[i]+"_img4").show();
				loadLayer(ids[i]);
			}
		}
	}else{
		Global.common.kjTitle = null;
		$("#zhfw-qjfs8>.panel-heading-imgname").css("color", "");
		//$(".panel-heading-imgs .img8").css("background", "");
		for(var i=0; i<ids.length; i++){
			if(!$("#tree_li_"+ids[i]+"_img3").is(":visible")){
				$("#tree_li_"+ids[i]+"_img3").show();
				$("#tree_li_"+ids[i]+"_img4").hide();
				closeLayer(ids[i]);
			}
		}
	}
}

/**
 * @note 切换底图
 * @author 吴义迪
 * @create_time 2017-09-14
 */
function changeBaseLayer(flag){
	if(flag == "vec"){
		$(".map_layer_image").css("border", "");
		$(".map_layer_word").css("color", "");
		$("#map_layer_vec").css("border", "2px solid #337FE5");
		$("#map_layer_vec_p").css("color", "#337FE5");
		Global.common.layer1.setVisibility(true);
		Global.common.layer2.setVisibility(false);
		Global.common.layer3.setVisibility(false);
		Global.common.layer4.setVisibility(true);
		Global.common.layer5.setVisibility(false);
		Global.common.layer6.setVisibility(false);
		if($("#map_layer_placename_img2").css("dislpay") == "none"){
			Global.common.layer4.setVisibility(false);
		}
		var layers = Global.common.map.getLayersByName(Config.layerType9Name[0]);
		if(layers.length > 0){
			for(var i=0; i<layers[0].features.length; i++){
				layers[0].features[i].style.fontColor = "#444";
			}
			layers[0].redraw();
		}
	}else if(flag == "img"){
		$(".map_layer_image").css("border", "");
		$(".map_layer_word").css("color", "");
		$("#map_layer_img").css("border", "2px solid #337FE5");
		$("#map_layer_img_p").css("color", "#337FE5");
		Global.common.layer1.setVisibility(false);
		Global.common.layer2.setVisibility(true);
		Global.common.layer3.setVisibility(false);
		Global.common.layer4.setVisibility(false);
		Global.common.layer5.setVisibility(true);
		Global.common.layer6.setVisibility(false);
		if($("#map_layer_placename_img2").css("dislpay") == "none"){
			Global.common.layer5.setVisibility(false);
		}
		var layers = Global.common.map.getLayersByName(Config.layerType9Name[0]);
		if(layers.length > 0){
			for(var i=0; i<layers[0].features.length; i++){
				layers[0].features[i].style.fontColor = "#efefef";
			}
			layers[0].redraw();
		}
	}else if(flag == "ter"){
		$(".map_layer_image").css("border", "");
		$(".map_layer_word").css("color", "");
		$("#map_layer_ter").css("border", "2px solid #337FE5");
		$("#map_layer_ter_p").css("color", "#337FE5");
		Global.common.layer1.setVisibility(false);
		Global.common.layer2.setVisibility(false);
		Global.common.layer3.setVisibility(true);
		Global.common.layer4.setVisibility(false);
		Global.common.layer5.setVisibility(false);
		Global.common.layer6.setVisibility(true);
		if($("#map_layer_placename_img2").css("dislpay") == "none"){
			Global.common.layer6.setVisibility(false);
		}
		var layers = Global.common.map.getLayersByName(Config.layerType9Name[0]);
		if(layers.length > 0){
			for(var i=0; i<layers[0].features.length; i++){
				layers[0].features[i].style.fontColor = "#444";
			}
			layers[0].redraw();
		}
	}
}

/**
 * @note 清除专题图层
 * @author 吴义迪
 * @create_time 2017-09-14
 */
function closeZtLayers(flag){
	if(flag == "zhfw-qjfs1"){
		for(var i=0; i<Config.kjLayers1.length; i++){
			if(!$("#tree_li_"+Config.kjLayers1[i]+"_img3").is(":visible")){
				$("#tree_li_"+Config.kjLayers1[i]+"_img3").show();
				$("#tree_li_"+Config.kjLayers1[i]+"_img4").hide();
				closeLayer(Config.kjLayers1[i]);
			}
		}
	}else if(flag == "zhfw-qjfs2"){
		for(var i=0; i<Config.kjLayers2.length; i++){
			if(!$("#tree_li_"+Config.kjLayers2[i]+"_img3").is(":visible")){
				$("#tree_li_"+Config.kjLayers2[i]+"_img3").show();
				$("#tree_li_"+Config.kjLayers2[i]+"_img4").hide();
				closeLayer(Config.kjLayers2[i]);
			}
		}
	}else if(flag == "zhfw-qjfs3"){
		for(var i=0; i<Config.kjLayers3.length; i++){
			if(!$("#tree_li_"+Config.kjLayers3[i]+"_img3").is(":visible")){
				$("#tree_li_"+Config.kjLayers3[i]+"_img3").show();
				$("#tree_li_"+Config.kjLayers3[i]+"_img4").hide();
				closeLayer(Config.kjLayers3[i]);
			}
		}
	}else if(flag == "zhfw-qjfs4"){
		for(var i=0; i<Config.kjLayers4.length; i++){
			if(!$("#tree_li_"+Config.kjLayers4[i]+"_img3").is(":visible")){
				$("#tree_li_"+Config.kjLayers4[i]+"_img3").show();
				$("#tree_li_"+Config.kjLayers4[i]+"_img4").hide();
				closeLayer(Config.kjLayers4[i]);
			}
		}
	}else if(flag == "zhfw-qjfs5"){
		for(var i=0; i<Config.kjLayers5.length; i++){
			if(!$("#tree_li_"+Config.kjLayers5[i]+"_img3").is(":visible")){
				$("#tree_li_"+Config.kjLayers5[i]+"_img3").show();
				$("#tree_li_"+Config.kjLayers5[i]+"_img4").hide();
				closeLayer(Config.kjLayers5[i]);
			}
		}
	}else if(flag == "zhfw-qjfs6"){
		for(var i=0; i<Config.kjLayers6.length; i++){
			if(!$("#tree_li_"+Config.kjLayers6[i]+"_img3").is(":visible")){
				$("#tree_li_"+Config.kjLayers6[i]+"_img3").show();
				$("#tree_li_"+Config.kjLayers6[i]+"_img4").hide();
				closeLayer(Config.kjLayers6[i]);
			}
		}
	}else if(flag == "zhfw-qjfs7"){
		for(var i=0; i<Config.kjLayers7.length; i++){
			if(!$("#tree_li_"+Config.kjLayers7[i]+"_img3").is(":visible")){
				$("#tree_li_"+Config.kjLayers7[i]+"_img3").show();
				$("#tree_li_"+Config.kjLayers7[i]+"_img4").hide();
				closeLayer(Config.kjLayers7[i]);
			}
		}
	}else if(flag == "zhfw-qjfs8"){
		for(var i=0; i<Config.kjLayers8.length; i++){
			if(!$("#tree_li_"+Config.kjLayers8[i]+"_img3").is(":visible")){
				$("#tree_li_"+Config.kjLayers8[i]+"_img3").show();
				$("#tree_li_"+Config.kjLayers8[i]+"_img4").hide();
				closeLayer(Config.kjLayers8[i]);
			}
		}
	}
}

/**
 * @note 添加poi图例
 * @author 吴义迪
 * @create_time 2017-07-28
 */
function addPoiLegend(id, legend){
	for(var j=0; j<Global.common.poiLegend.length; j++){
		if(Global.common.poiLegend[j].id == id){
			Global.common.poiLegend.splice(j--, 1);
		}
	}
	var levels = legend.levels;
	var colors = legend.colors;
	var type = legend.type;
	var name = $("#tree_li_"+id+"").attr("layername");
	var opacity = legend.value;
	//设置左内边距
	var legendLevels = levels.split(",");
	var legendColors = colors.split(";");
	//图例类型为颜色
	if(type == "1"){
		for(var i=0; i<legendLevels.length; i++){
			Global.common.poiLegend.push({"id":id, "text":"<li style=\"height:25px; padding:3px 0 10px 0;\"><div class=\"legendColor_div_"+id+"\" style=\"float:left; margin:0 5px 0 0; width:15px; height:15px; background:"+legendColors[i]+"; opacity:"+opacity+"; border:1px solid #aaa;\"></div><div style=\"float:left;\">"+legendLevels[i]+"</div></li>"});
		}
	}
	//图例类型为图片
	else if(type == "2"){
		for(var i=0; i<legendLevels.length; i++){
			if(legendColors[i] != "-1"){
				Global.common.poiLegend.push({"id":id, "text":"<li style=\"height:25px; padding:3px 0 3px 0;\"><div style=\"float:left; margin:2px 5px 0 0; width:16px; height:16px;\"><img src=\""+legendColors[i]+"\" style=\"width:100%; height:100%; position:relative; bottom:4px;\"/></div><div style=\"float:left;font-size:12px;margin-top:2px;\">"+legendLevels[i]+"</div></li>"});
			}
		}
	}
	//图例类型为点
	else if(type == "3"){
		for(var i=0; i<legendLevels.length; i++){
			Global.common.poiLegend.push({"id":id, "text":"<li style=\"height:25px; padding:3px 0 3px 0;\"><div class=\"legendColor_div_"+id+"\" style=\"float:left; margin:0 5px 0 0; width:15px; height:15px; background:"+legendColors[i]+"; opacity:"+opacity+"; border:1px solid rgba(204,204,204,0.5); border-radius:50% !important;\"></div><div style=\"float:left;\">"+legendLevels[i]+"</div></li>"});
		}
	}
	//图例类型为线
	else if(type == "4"){
		for(var i=0; i<legendLevels.length; i++){
			Global.common.poiLegend.push({"id":id, "text":"<li style=\"height:25px; padding:3px 0 3px 0;\"><div class=\"legendColor_div_"+id+"\" style=\"float:left; margin:0 5px 0 0; width:60px; height:10px; opacity:"+opacity+"; border-bottom:2px solid "+legendColors[i]+"\"></div><div style=\"float:left;\">"+legendLevels[i]+"</div></li>"});
		}
	}
	//图例类型为聚散图片
	else if(type == "5"){
		Global.common.poiLegend.push({"id":id, "text":"<li style=\"height:25px; padding:3px 0 3px 0;\"><div style=\"float:left; margin:0 5px 0 0; background:"+legendColors[0]+"; width:16px; height:16px; opacity:0.8; border-radius:50% !important;\"></div><div style=\"float:left;font-size:12px;\">"+legendLevels[0]+"</div></li>"});
		for(var i=1; i<legendLevels.length; i++){
			Global.common.poiLegend.push({"id":id, "text":"<li style=\"height:25px; padding:3px 0 3px 0;\"><div style=\"float:left; margin:2px 5px 0 0; width:16px; height:16px;\"><img src=\""+legendColors[i]+"\" style=\"width:100%; height:100%; position:relative; bottom:4px;\"/></div><div style=\"float:left;font-size:12px;\">"+legendLevels[i]+"</div></li>"});
		}
	}
	//图例类型为聚散点
	else if(type == "6"){
		Global.common.poiLegend.push({"id":id, "text":"<li style=\"height:25px; padding:3px 0 3px 0;\"><div style=\"float:left; margin:0 5px 0 0; background:"+legendColors[0]+"; width:16px; height:16px; opacity:0.8; border-radius:50% !important;\"></div><div style=\"float:left;font-size:12px;\">"+legendLevels[0]+"</div></li>"});
		for(var i=1; i<legendLevels.length; i++){
			Global.common.poiLegend.push({"id":id, "text":"<li style=\"height:25px; padding:3px 0 3px 0;\"><div style=\"float:left; margin:2px 5px 0 2px; background:"+legendColors[i]+"; opacity:"+opacity+"; border:1px solid rgba(204,204,204,0.5); width:12px; height:12px; border-radius:50% !important;\"></div><div style=\"float:left;font-size:12px;\">"+legendLevels[i]+"</div></li>"});
		}
	}
	drawPoiLegend();
}

/**
 * @note 添加灾情/农情调查分布图例
 * @author 陈靖宇
 * @create_time 2018-07-03
 */
function addFenbuLegend(id){
	Global.common.poiLegend = [];
	$("#tuli").text("图例");
	//图例类型为颜色
	if( Global.common.farmnum.length >0 ){
		for(var i=0; i<Global.common.farmnum.length; i++){
			Global.common.poiLegend.push({"id":id, "text":"<li style=\"height:25px; padding:3px 0 10px 0;\"><div class=\"legendColor_div_"+id+"\" style=\"float:left; margin:0 5px 0 0; width:auto; height:15px; opacity:1;\"></div><div style=\"float:left;\">"+Global.common.farmnum[i]+"</div></li>"});
		}		
	}	
	drawPoiLegend();	
}

/**
 * @note 删除poi图例
 * @author 吴义迪
 * @create_time 2017-07-30
 */
function removePoiLegend(id){
	for(var i=0; i<Global.common.poiLegend.length; i++){
		if(Global.common.poiLegend[i].id == id){
			Global.common.poiLegend.splice(i--, 1);
		}
	}
	drawPoiLegend();
}

/**
 * @note 绘制poi图例
 * @author 吴义迪
 * @create_time 2017-07-30
 */
function drawPoiLegend(){
	$("#zhfw_zt_legend_div").empty();
	$("#zhfw_zt_legend_div1").empty();
	$("#zhfw_zt_legend_div2").empty();
	if(Global.common.poiLegend.length <= 0){
		$("#zhfw-zt-legend_div").hide();
	}else{
		$("#zhfw-zt-legend_div").show();
		var index = 0;
		for(var i=0; i<Global.common.poiLegend.length; i++){
			if(i % 3 == 0){
				index = 0;
			}
			if(index == 0){
				$("#zhfw_zt_legend_div").append(Global.common.poiLegend[i].text);
			}else{
				$("#zhfw_zt_legend_div"+index+"").append(Global.common.poiLegend[i].text);
			}
			index ++;
		}
	}
}

/**
 * @note 获取 自定义选项时间轴
 * @author 陈靖宇
 * @create_time 2018-07-16
 */
function getTimeParam(id, flag){
	Global.common.timeAxisType = flag;
	// Config[id].timeAxisType = flag;
	$("#timeAxis_input").val(timeFormat1(new Date()));
	var param = {};
	var year = parseInt($("#timeAxis_input").val().substring(0, 4));
	var month = parseInt($("#timeAxis_input").val().substring(5, 7));
	var day = parseInt($("#timeAxis_input").val().substring(8, 10));
	if(flag == "DAY"){
		param.value = [
				         {"time": "01", "flag":"01"},
				         {"time": "02", "flag":"02"},
				         {"time": "03", "flag":"03"},
				         {"time": "04", "flag":"04"},
				         {"time": "05", "flag":"05"},
				         {"time": "06", "flag":"06"},
				         {"time": "07", "flag":"07"},
				         {"time": "08", "flag":"08"},
				         {"time": "09", "flag":"09"}
				        ];
		var dayLen = dayNumOfMonthbyYM(year, month);
		for(var i=10; i<=dayLen; i++){
			param.value.push({"time": i, "flag":i});
		}
		// if(Config[id].initTimeAxisTimeFlag == true){
		 	param.index = (day - 2) < 0 ? 0 : (day - 2);
		// }else{
		// 	param.index = (day - 1) < 0 ? 0 : (day - 1);
		// }
		param.index1 = 1;
		$(".timeAxis").hide();
		$("#timeAxis_input_date").show();
		$("#timeAxis_input_date").val($("#timeAxis_input").val().substring(0,8) + param.value[param.index].flag + $("#timeAxis_input").val().substring(10));
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,10) + " " + param.value[param.index].flag + ":00:00");
	}
	// Config[id].initTimeAxisTimeFlag = true;
	return param;
}

/**
 * @note 获取时间轴刻度内容
 * @author 吴义迪
 * @create_time 2017-08-08
 */
function getTimeAxisParam(id, flag){
	Global.common.timeAxisType = flag;
	Config[id].timeAxisType = flag;
	if(Config[id].initTimeAxisTimeFlag == true){
		$("#timeAxis_input").val(timeFormat1(new Date()));
	}
	var param = {};
	var year = parseInt($("#timeAxis_input").val().substring(0, 4));
	var month = parseInt($("#timeAxis_input").val().substring(5, 7));
	var day = parseInt($("#timeAxis_input").val().substring(8, 10));
	var tendays = parseInt($("#timeAxis_input").val().substring(10, 12));
	var hour = parseInt($("#timeAxis_input").val().substring(11, 13));
	if(flag == "YEAR"){
		param.value = [];
		for(var i=(year-9); i<=year; i++){
			param.value.push({"time": i+"年", "flag":i+""});
		}
		param.index = 8;
		param.index1 = 1;
		$(".timeAxis").hide();
		$("#timeAxis_input_year").show();
		$("#timeAxis_input_year").val(param.value[param.index].flag + $("#timeAxis_input").val().substring(4));
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,10) + " " + param.value[param.index].flag + ":00:00");
	}else if(flag == "MONTH"){
		param.value = [
		         {"time": "1月", "flag":"01"},
		         {"time": "2月", "flag":"02"},
		         {"time": "3月", "flag":"03"},
		         {"time": "4月", "flag":"04"},
		         {"time": "5月", "flag":"05"},
		         {"time": "6月", "flag":"06"},
		         {"time": "7月", "flag":"07"},
		         {"time": "8月", "flag":"08"},
		         {"time": "9月", "flag":"09"},
		         {"time": "10月", "flag":"10"},
		         {"time": "11月", "flag":"11"},
		         {"time": "12月", "flag":"12"}
		        ];
		if(Config[id].initTimeAxisTimeFlag == true){
			param.index = (month - 2) < 0 ? 0 : (month - 2);
		}else{
			param.index = (month - 1) < 0 ? 0 : (month - 1);
		}
		param.index1 = 1;
		$(".timeAxis").hide();
		$("#timeAxis_input_month").show();
		$("#timeAxis_input_month").val($("#timeAxis_input").val().substring(0,5) + param.value[param.index].flag + $("#timeAxis_input").val().substring(7));
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,10) + " " + param.value[param.index].flag + ":00:00");
	}else if(flag == "DAY"){
		param.value = [
				         {"time": "01", "flag":"01"},
				         {"time": "02", "flag":"02"},
				         {"time": "03", "flag":"03"},
				         {"time": "04", "flag":"04"},
				         {"time": "05", "flag":"05"},
				         {"time": "06", "flag":"06"},
				         {"time": "07", "flag":"07"},
				         {"time": "08", "flag":"08"},
				         {"time": "09", "flag":"09"}
				        ];
		var dayLen = dayNumOfMonthbyYM(year, month);
		for(var i=10; i<=dayLen; i++){
			param.value.push({"time": i, "flag":i});
		}
		if(Config[id].initTimeAxisTimeFlag == true){
			param.index = (day - 2) < 0 ? 0 : (day - 2);
		}else{
			param.index = (day - 1) < 0 ? 0 : (day - 1);
		}
		param.index1 = 1;
		$(".timeAxis").hide();
		$("#timeAxis_input_date").show();
		$("#timeAxis_input_date").val($("#timeAxis_input").val().substring(0,8) + param.value[param.index].flag + $("#timeAxis_input").val().substring(10));
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,10) + " " + param.value[param.index].flag + ":00:00");
	}else if(flag == "YUBAO"){
		param.value = [
				         {"time": "24", "flag":"24"},
				         {"time": "48", "flag":"48"},
				         {"time": "72", "flag":"72"},
				         {"time": "96", "flag":"96"},
				         {"time": "120", "flag":"120"},
				         {"time": "144", "flag":"144"},
				         {"time": "168", "flag":"168"},
				         {"time": "192", "flag":"192"},
						 {"time": "216", "flag":"216"},
						 {"time": "240", "flag":"240"},
					  ];	
		param.index = 0;	
		param.index1 = 1;
		$(".timeAxis").hide();
		$("#timeAxis_input_yubao").show();
		$("#timeAxis_input_yubao").val(param.value[param.index].flag);
		$("#timeAxis_input").val(param.value[param.index].flag);
	}else if(flag == "HOUR"){
		param.value = [
		         {"time": "00:00", "flag":"00"},
		         {"time": "01:00", "flag":"01"},
		         {"time": "02:00", "flag":"02"},
		         {"time": "03:00", "flag":"03"},
		         {"time": "04:00", "flag":"04"},
		         {"time": "05:00", "flag":"05"},
		         {"time": "06:00", "flag":"06"},
		         {"time": "07:00", "flag":"07"},
		         {"time": "08:00", "flag":"08"},
		         {"time": "09:00", "flag":"09"},
		         {"time": "10:00", "flag":"10"},
		         {"time": "11:00", "flag":"11"},
		         {"time": "12:00", "flag":"12"},
		         {"time": "13:00", "flag":"13"},
		         {"time": "14:00", "flag":"14"},
		         {"time": "15:00", "flag":"15"},
		         {"time": "16:00", "flag":"16"},
		         {"time": "17:00", "flag":"17"},
		         {"time": "18:00", "flag":"18"},
		         {"time": "19:00", "flag":"19"},
		         {"time": "20:00", "flag":"20"},
		         {"time": "21:00", "flag":"21"},
		         {"time": "22:00", "flag":"22"},
		         {"time": "23:00", "flag":"23"}
		        ];
		param.index = hour;
		param.index1 = 2;
		$(".timeAxis").hide();
		$("#timeAxis_input_date").show();
		$("#timeAxis_input_date").val($("#timeAxis_input").val().substring(0,8) + param.value[param.index].flag + $("#timeAxis_input").val().substring(10));
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,10) + " " + param.value[param.index].flag + ":00:00");
	}else if(flag == "grib"){
		param.value = [];
		for(var i=3; i<=72; i=i+3){
			param.value.push({"time": ""+i+"", "flag":""+(i/3-1)+""});
		}
		param.index = 0;
		param.index1 = 2;
		$(".timeAxis").hide();
		$("#timeAxis_input_date").show();
		$("#timeAxis_input_date").val($("#timeAxis_input").val().substring(0,10) + " 00:00:00");
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,10) + " 00:00:00");
	}else if(flag == "radar"){
		Config[id].value = [
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726021226.bin.png", "time":"10:12"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726022257.bin.png", "time":"10:23"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726023330.bin.png", "time":"10:33"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726023847.bin.png", "time":"10:38"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726024405.bin.png", "time":"10:44"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726024923.bin.png", "time":"10:49"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726025440.bin.png", "time":"10:54"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726025955.bin.png", "time":"10:59"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726030512.bin.png", "time":"11:05"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726031030.bin.png", "time":"11:10"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726031544.bin.png", "time":"11:15"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726032100.bin.png", "time":"11:21"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726033133.bin.png", "time":"11:31"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726033647.bin.png", "time":"11:36"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726035232.bin.png", "time":"11:52"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726040302.bin.png", "time":"12:03"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726042358.bin.png", "time":"12:23"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726042914.bin.png", "time":"12:29"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726043429.bin.png", "time":"12:34"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726043940.bin.png", "time":"12:39"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726044456.bin.png", "time":"12:44"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726045527.bin.png", "time":"12:55"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726050037.bin.png", "time":"13:00"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726050601.bin.png", "time":"13:06"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726055828.bin.png", "time":"13:58"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726060854.bin.png", "time":"14:08"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726061409.bin.png", "time":"14:14"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726062436.bin.png", "time":"14:24"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726062952.bin.png", "time":"14:29"},
	         {"url": Global.common.path+"/base/radar/Z9470/2017/RADA_CHN_DOR_L2_O-Z9470-CD-CAP-20170726064020.bin.png", "time":"14:40"},
	         ];
		param.value = Config[id].value;
		param.index = 0;
		param.index1 = 4;
		$(".timeAxis").hide();
		$("#timeAxis_input_datetime").show();
		$("#timeAxis_input_datetime").val($("#timeAxis_input").val().substring(0,10) + " 00:00:00");
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,10) + " 00:00:00");
	}else if(flag == "nephogram"){
		Config[id].value = [
            {"url": Global.common.path+"/base/yuntu/2017/201707260000.png", "time":"00:00"},
            {"url": Global.common.path+"/base/yuntu/2017/201707260030.png", "time":"00:30"},
            {"url": Global.common.path+"/base/yuntu/2017/201707260100.png", "time":"01:00"},
            {"url": Global.common.path+"/base/yuntu/2017/201707260130.png", "time":"01:30"},
            {"url": Global.common.path+"/base/yuntu/2017/201707260200.png", "time":"02:00"},
            {"url": Global.common.path+"/base/yuntu/2017/201707260400.png", "time":"04:00"},
            {"url": Global.common.path+"/base/yuntu/2017/201707260430.png", "time":"04:30"},
            {"url": Global.common.path+"/base/yuntu/2017/201707260500.png", "time":"05:00"},
            {"url": Global.common.path+"/base/yuntu/2017/201707260530.png", "time":"05:30"},
            {"url": Global.common.path+"/base/yuntu/2017/201707260600.png", "time":"06:00"},
            {"url": Global.common.path+"/base/yuntu/2017/201707260630.png", "time":"06:30"},
            {"url": Global.common.path+"/base/yuntu/2017/201707260700.png", "time":"07:00"},
            {"url": Global.common.path+"/base/yuntu/2017/201707260830.png", "time":"08:30"},
            {"url": Global.common.path+"/base/yuntu/2017/201707260900.png", "time":"09:00"},
            {"url": Global.common.path+"/base/yuntu/2017/201707261000.png", "time":"10:00"},
            {"url": Global.common.path+"/base/yuntu/2017/201707261030.png", "time":"10:30"},
            {"url": Global.common.path+"/base/yuntu/2017/201707261100.png", "time":"11:00"},
            {"url": Global.common.path+"/base/yuntu/2017/201707261130.png", "time":"11:30"},
            {"url": Global.common.path+"/base/yuntu/2017/201707261200.png", "time":"12:00"},
            {"url": Global.common.path+"/base/yuntu/2017/201707261230.png", "time":"12:30"},
            ];
		param.value = Config[id].value;
		param.index = 0;
		param.index1 = 4;
		$(".timeAxis").hide();
		$("#timeAxis_input_datetime").show();
		$("#timeAxis_input_datetime").val($("#timeAxis_input").val().substring(0,10) + " 00:00:00");
		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,10) + " 00:00:00");
	}else if(flag == "TENDAYS"){
		param.value = [
			{"time": "1月上", "flag":"01-01"},
			{"time": "1月中", "flag":"01-11"},
			{"time": "1月下", "flag":"01-21"},
		   ];
		for(var i=2; i<=12; i++){
			if( i >= 10){
				param.value.push({"time": i+"月上", "flag": i+"-01"});
				param.value.push({"time": i+"月中", "flag": i+"-11"});
				param.value.push({"time": i+"月下", "flag": i+"-21"});
			} else {
				param.value.push({"time": i+"月上", "flag": "0"+i+"-01"});
				param.value.push({"time": i+"月中", "flag": "0"+i+"-11"});
				param.value.push({"time": i+"月下", "flag": "0"+i+"-21"});
			}		
		}   
		if(Config[id].initTimeAxisTimeFlag == true){
			param.index = (tendays - 2) < 0 ? 0 : (tendays - 2);
		}else{
			param.index = (tendays - 1) < 0 ? 0 : (tendays - 1);
		}
		var dates= new Date();
		var months = dates.getMonth()+1;
		var days = dates.getDate()
		console.log(param.value.length);
		if(months<10){
			months = "0"+months;
		}
		if(days<10){
			days = "01";
		} else if(days>=10 && days<20){
			days = "11";
		} else {
			days = "21";
		}	
		var time = ""+months+"-"+days;
		for( i=0;i<param.value.length; i++ ){
			if( time == param.value[i].flag ){
				param.index = i;
				break;
			}else{
				param.index = 0;
			}
		}		
		param.index1 = 1;
		$(".timeAxis").hide();
		$("#play-time").hide(); //隐藏选择日历按钮
   		$("#timeAxis_input_tendays").show();
   		$("#timeAxis_input_tendays").val($("#timeAxis_input").val().substring(0,5) + param.value[param.index].flag + $("#timeAxis_input").val().substring(10));
   		$("#timeAxis_input").val($("#timeAxis_input").val().substring(0,5) + "" + param.value[param.index].flag + ":00:00");
	}
	Config[id].initTimeAxisTimeFlag = true;
	return param;
}

/**
 * @note 时间轴日期选择回调函数
 * @author 吴义迪
 * @create_time 2017-08-08
 */
function timeAxisCallback(date){
	$("#timeAxis_input").val(date);
	var id = Global.common.timeAxis[Global.common.timeAxis.length-1].id;
	Config[id].initTimeAxisFlag = true;
	Config[id].initTimeAxisTimeFlag = false;
	loadLayer(id);
}

/**
 * @note 加载格点数据
 * @author 吴义迪
 * @create_time 2017-08-11
 */
var DataGridAll={
    "ER03" 	 : "降水",
    "ER12" 	 : "12h降水",
    "ER24" 	 : "24h降水",
    "2T"     : "温度",
    "TMP" 	 : "温度",
    "TMAX" 	 : "日最高温度",
    "TEM_Max": "日最高温度",
    "TMIN" 	 : "日最低温度",
    "TEM_Min": "日最低温度",
    "ERH" 	 : "湿度",
    "ERHA" 	 : "最大湿度",
    "ERHI" 	 : "最小湿度",
    "EDA10"  : "风",
    "ECT" 	 : "总云量",
    "VIS"	 : "能见度"
};
var GribData = {};
function loadGribData(id, type, startValid, endValid, startime, timeFlag){
	loadingFunc(id, true);
	$.ajax({
		url: "http://127.0.0.1:8088/baseframeworkweb/grid/getGridData.do",
		type: "post",
		data: {elementValue: type, startValid:startValid, endValid:endValid, startime:startime, timeFlag:timeFlag},
		dataType: "json",
		//回调函数
		success:function(result){
			if(result.status >= 0){
				GribData[type] = result.data;
				showGribLayer(id, GribData[type], type);
			}else{
				GribData[type] = null;
				loadingFunc(id, false);
			}
		},
		error:function(){
			//异常处理
			window.console.log("加载格点数据异常");
		}
	});
}

/**
 * @note 展示格点图层
 * @author 吴义迪
 * @create_time 2017-08-11
 */
function showGribLayer(id, data, type){
	if(data != null){
		var layers = Global.common.map.getLayersByName("layer_"+id+"");
		if(layers.length <= 0){
			//创建填值，色图层
			var fillDataANDColorLayer = new SuperMap.Layer.FillRangeColorLayer(
			"layer_"+id+"", {
	            "radius": 50,
	            "featureWeight": "value",
	            "featureRadius": "geoRadius"
			});
			fillDataANDColorLayer.isAlwaySmooth = false;
			fillDataANDColorLayer.isSmooth = false;
			fillDataANDColorLayer.isShowLabel = true;
			fillDataANDColorLayer.isShowColor=true;
		    fillDataANDColorLayer.isShowLabel=true;
		    fillDataANDColorLayer.isShowGridline=false;
			layers.push(fillDataANDColorLayer);
			// 将该图层添加到地图上,这个map就是创建的那个地图对象
		    Global.common.map.addLayer(layers[0]);
		}else{
			layers[0].removeAllFeatures();
		}
		DataGridAll[type] = data[type];
		layers[0].datasetGrid=DataGridAll[type];
		layers[0].currentValidIndex=Config[id].valid;
		//或企业配色方案
		layers[0].items=getFillColorItems(type);
		layers[0].redraw();
	}
	loadingFunc(id, false);
}

/**
 * @note 展示预警信息发布情况
 * @author 吴义迪
 * @create_time 2017-09-22
 */
function openYJXHResultInfo(id, type, level, msgtype){
	closePopup();
	$(".bubble-box").remove();
	var alert_level = "";
	var alert_msgtype = "";
	if(level == "0"){
		alert_level = "RED";
	}else if(level == "1"){
		alert_level = "ORANGE";
	}else if(level == "2"){
		alert_level = "YELLOW";
	}else if(level == "3"){
		alert_level = "BLUE";
	}
	if(msgtype = "0"){
		alert_msgtype = "ALERT"; 
	}else if(msgtype = "1"){
		alert_msgtype = "UPDATE";
	}else if(msgtype = "2"){
		alert_msgtype = "CANCEL";
	}
	var xmlName = id + "_" + type + "_" + alert_level + "_" + alert_msgtype + ".xml";
	$.ajax({
		url: Global.common.ajaxPath + "/getAlertXmlInfo.do",
		type: "post",
		data: {"xmlName":xmlName},
		dataType: "json",
		//回调函数
		success:function(result){
			var data = result.data;
			if(data != null){
				flagStr = "";
				var html = "<div class=\"bubble-box alert\">" +
				 		   "	<div class=\"bubble-tit\">" +
				 		   "		<h3>"+data.title+"</h3>" +
				 		   "		<button onclick=\"clearYjTimeout();\" type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"" +
					       "			style=\"color: #fff;position:absolute;top:2px;right:7px;opacity: 1;\">" +
					       "			<span aria-hidden=\"true\">&times;</span>" +
				 		   "		</button>" +
				 		   "	</div>" +
				 		   "	<div class=\"scroll-hide\">" +
				 		   "		<div class=\"bubble-list\">" +
				 		   "			<ul style=\"margin:0;\">";
				for(var i=0; i<data.method.length; i++){
					var name = data.method[i].name;
					var picUrl = "";
					if(i == (data.method.length - 1)){
						flagStr += name;
					}else{
						flagStr += name + ",";
					}
					if(data.method[i].name == "SPEAKER"){
						name = "大喇叭";
						picUrl = "resources/img/png/dalaba.png";
					}else if(data.method[i].name == "LED"){
						name = "电子屏";
						picUrl = "resources/img/png/xianshiqi.png";
					}else if(data.method[i].name == "BEIDOU"){
						name = "北斗";
						picUrl = "resources/img/png/weixing.png";
					}else if(data.method[i].name == "EMAIL"){
						name = "邮件";
						picUrl = "resources/img/png/youjian (1).png";
					}else if(data.method[i].name == "SMS"){
						name = "短信";
						picUrl = "resources/img/png/duanxin.png";
					}else if(data.method[i].name == "TV"){
						name = "电视";
						picUrl = "resources/img/png/dianshi.png";
					}else if(data.method[i].name == "BROADCAST"){
						name = "广播";
						picUrl = "resources/img/png/guangbo.png";
					}else if(data.method[i].name == "WEB"){
						name = "网站";
						picUrl = "resources/img/png/wangzhan.png";
					}else if(data.method[i].name == "WEIBO"){
						name = "微博";
						picUrl = "resources/img/png/weibo.png";
					}else if(data.method[i].name == "WEIXIN"){
						name = "微信";
						picUrl = "resources/img/png/weixin.png";
					}else if(data.method[i].name == "APP"){
						name = "手机端";
						picUrl = "resources/img/png/shouji.png";
					}
					html += "<li>" +
                    		"	<div class=\"bubble-method\">" +
							"		<span class=\"bubble-list-img\"><img src=\""+picUrl+"\" alt=\"\"></span>" +
							"		<span class=\"bubble-list-name\">"+name+"</span>" +
							"	</div>" +
							"	<div class=\"bubble-info\">" +
	                        "		<div class=\"h5\" title=\""+data.method[i].message+"\">"+data.method[i].message+"</div>" +
	                        "		<div class=\"progress\" style=\"border-radius: 6px!important;\">" +
	                        "			<div id=\"yj_"+data.method[i].name+"_bar\" class=\"progress-bar progress-bar-striped active\" role=\"progressbar\" aria-valuenow=\"80\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width:0%;line-height:17px;\">" +
	                        "        		<span id=\"yj_"+data.method[i].name+"_span1\">0%</span>" +
	                        "			</div>" +
	                        "		</div>" +
	                        "		<a href=\"#\"><h5>应发送<span id=\"yj_"+data.method[i].name+"_span4\">"+data.method[i].count+"</span>条,成功<span id=\"yj_"+data.method[i].name+"_span2\">...</span>条,失败<span id=\"yj_"+data.method[i].name+"_span3\">...</span>条</h5></a>" +
	                        "	</div>" + 
							"</li>";
				}
				html += "</ul>" +
						"</div>" +
						"</div>" +
						"</div>";
				$("body").append(html);
				positionMapCenter($(".bubble-box"));
				getYJXHResultInfo(flagStr, id);
			}
		},
		error:function(){
			//异常处理
			window.console.log("请求预警xml文件异常");
		}
	});
}

/**
 * @note 获取信息发布情况
 * @author 吴义迪
 * @create_time 2017-09-26
 */
var whole_yj_timeout = null;
function getYJXHResultInfo(flagStr, alert_id){
	$.ajax({
		url: Global.common.ajaxPath + "/getYJXHResultInfo.do",
		type: "post",
		data: {"flagStr":flagStr, "alert_id":alert_id},
		dataType: "json",
		//回调函数
		success:function(result){
			console.log(1);
			var flagArr = flagStr.split(",");
			var data = result.data;
			var flagStr1 = "";
			for(var i=0; i<flagArr.length; i++){
				if($("#yj_"+flagArr[i]+"_span1").html() == "100%" || data[flagArr[i]] == null || data[flagArr[i]].flag1 == null || data[flagArr[i]].flag2 == null){
					continue;
				}
				$("#yj_"+flagArr[i]+"_span2").html(data[flagArr[i]].flag1);
				$("#yj_"+flagArr[i]+"_span3").html(data[flagArr[i]].flag2);
				var value = ((parseInt(data[flagArr[i]].flag1) + parseInt(data[flagArr[i]].flag2))/parseInt($("#yj_"+flagArr[i]+"_span4").html())).toFixed(2) * 100 + "%";
				if(parseInt($("#yj_"+flagArr[i]+"_span4").html()) == 0){
					$("#yj_"+flagArr[i]+"_bar").css("width", "100%");
					$("#yj_"+flagArr[i]+"_span1").html("100%");
				}else{
					$("#yj_"+flagArr[i]+"_bar").css("width", value);
					$("#yj_"+flagArr[i]+"_span1").html(value);
				}
				
				if((parseInt(data[flagArr[i]].flag1) + parseInt(data[flagArr[i]].flag2)) != parseInt($("#yj_"+flagArr[i]+"_span4").html())){
					flagStr1 += flagArr[i] + ",";
				}
			}
			if(flagStr1 != ""){
				whole_yj_timeout = setTimeout(function(){
					getYJXHResultInfo(flagStr1.substring(0, flagStr1.length-1), alert_id);
				}, 1000*5);
			}
		},
		error:function(){
			//异常处理
			window.console.log("获取信息发布情况异常");
		}
	});
}

/**
 * @note 等待效果
 * @author 吴义迪
 * @create_time 2017-09-26
 */
function loadingFunc(id, flag){
	if(flag == true){
		$("body").append("<div id=\"loading_"+id+"\" class=\"loading_div\"><div class=\"loading_pic\"><i></i><i></i><i></i><i></i><i></i></div></div>");
	}else{
		$("#loading_"+id+"").remove();
	}
}

function clearYjTimeout(){
	if(whole_yj_timeout != null){
		clearTimeout(whole_yj_timeout);
	}
}